Skip to content

Two test regressions related to IP addresses in Python 3.14 #112

Description

@musicinmybrain

To run tests in test/test_other.py without Pydantic (which I can’t yet install in a Python 3.14 virtualenv), I hacked up tests/test_other.py by removing all the tests that call IsUUID or IsUrl. Then:

$ git checkout https://github.com/samuelcolvin/dirty-equals.git
$ cd dirty-equals
$ python3.14 --version
Python 3.14.0a5
$ python3.14 -m venv _e
$ . _e/bin/activate
(_e) $ pip install -e .
(_e) $ pip install -r requirements/tests.txt
(_e) $ TZ=UTC python -m pytest
======================================== test session starts =========================================
platform linux -- Python 3.14.0a5, pytest-8.3.2, pluggy-1.5.0
rootdir: /home/ben/src/forks/dirty-equals
configfile: pyproject.toml
testpaths: tests
plugins: mock-3.14.0, examples-0.0.13, pretty-1.2.0
collected 581 items                                                                                  

tests/test_base.py ................................                                            [  5%]
tests/test_boolean.py ............................................                             [ 13%]
tests/test_datetime.py ..................................................                      [ 21%]
tests/test_dict.py ..........................................................                  [ 31%]
tests/test_docs.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss                [ 41%]
tests/test_inspection.py ............................                                          [ 46%]
tests/test_list_tuple.py ..................................................................... [ 58%]
.........                                                                                      [ 60%]
tests/test_numeric.py ........................................................................ [ 72%]
...........                                                                                    [ 74%]
tests/test_other.py ................F                                                          [ 77%]
tests/test_other.py:116 test_is_ip_true[other1-dirty1] - AssertionError: assert IPv4Networ…
tests/test_other.py .F                                                                         [ 77%]
tests/test_other.py:116 test_is_ip_true[other3-dirty3] - AssertionError: assert IPv6Networ…
tests/test_other.py ......................................................................     [ 89%]
tests/test_strings.py ...........................................................              [100%]

============================================== FAILURES ==============================================
___________________________________ test_is_ip_true[other1-dirty1] ___________________________________

other = IPv4Network('43.48.0.0/12'), dirty = IsIP()

    @pytest.mark.parametrize(
        'other,dirty',
        [
            (IPv4Address('127.0.0.1'), IsIP()),
            (IPv4Network('43.48.0.0/12'), IsIP()),
            (IPv6Address('::eeff:ae3f:d473'), IsIP()),
            (IPv6Network('::eeff:ae3f:d473/128'), IsIP()),
            ('2001:0db8:0a0b:12f0:0000:0000:0000:0001', IsIP()),
            ('179.27.154.96', IsIP),
            ('43.62.123.119', IsIP(version=4)),
            ('::ffff:2b3e:7b77', IsIP(version=6)),
            ('0:0:0:0:0:ffff:2b3e:7b77', IsIP(version=6)),
            ('54.43.53.219/10', IsIP(version=4, netmask='255.192.0.0')),
            ('::ffff:aebf:d473/12', IsIP(version=6, netmask='fff0::')),
            ('2001:0db8:0a0b:12f0:0000:0000:0000:0001', IsIP(version=6)),
            (3232235521, IsIP()),
            (b'\xc0\xa8\x00\x01', IsIP()),  
            (338288524927261089654018896845572831328, IsIP(version=6)),
            (b'\x20\x01\x06\x58\x02\x2a\xca\xfe\x02\x00\x00\x00\x00\x00\x00\x01', IsIP(version=6)),
        ],
    )
    def test_is_ip_true(other, dirty):
>       assert other == dirty
E       AssertionError: assert IPv4Network('43.48.0.0/12') == IsIP()

tests/test_other.py:139: AssertionError
___________________________________ test_is_ip_true[other3-dirty3] ___________________________________

other = IPv6Network('::eeff:ae3f:d473/128'), dirty = IsIP()

    @pytest.mark.parametrize(
        'other,dirty',
        [
            (IPv4Address('127.0.0.1'), IsIP()),
            (IPv4Network('43.48.0.0/12'), IsIP()),
            (IPv6Address('::eeff:ae3f:d473'), IsIP()),
            (IPv6Network('::eeff:ae3f:d473/128'), IsIP()),
            ('2001:0db8:0a0b:12f0:0000:0000:0000:0001', IsIP()),
            ('179.27.154.96', IsIP),         
            ('43.62.123.119', IsIP(version=4)),
            ('::ffff:2b3e:7b77', IsIP(version=6)),
            ('0:0:0:0:0:ffff:2b3e:7b77', IsIP(version=6)),
            ('54.43.53.219/10', IsIP(version=4, netmask='255.192.0.0')),
            ('::ffff:aebf:d473/12', IsIP(version=6, netmask='fff0::')),
            ('2001:0db8:0a0b:12f0:0000:0000:0000:0001', IsIP(version=6)),
            (3232235521, IsIP()),
            (b'\xc0\xa8\x00\x01', IsIP()),   
            (338288524927261089654018896845572831328, IsIP(version=6)),
            (b'\x20\x01\x06\x58\x02\x2a\xca\xfe\x02\x00\x00\x00\x00\x00\x00\x01', IsIP(version=6)),
        ],
    )
    def test_is_ip_true(other, dirty):
>       assert other == dirty
E       AssertionError: assert IPv6Network('::eeff:ae3f:d473/128') == IsIP()

tests/test_other.py:139: AssertionError
                                         Summary of Failures                                          
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃  File                 ┃  Function              ┃  Function Line  ┃  Error Line  ┃  Error           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│  tests/test_other.py  │  test_is_ip_true[oth…  │  117            │  139         │  AssertionError  │
│  tests/test_other.py  │  test_is_ip_true[oth…  │  117            │  139         │  AssertionError  │
└───────────────────────┴────────────────────────┴─────────────────┴──────────────┴──────────────────┘
Results (0.32s):
         2 failed
       519 passed
        60 skipped

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions