The following tests fail on pypy3.9 (7.3.9):
FAILED tests/test_base.py::test_not_repr - Failed: DID NOT RAISE <class 'AssertionError'>
FAILED tests/test_boolean.py::test_dirty_not_equals - Failed: DID NOT RAISE <class 'AssertionError'>
FAILED tests/test_dict.py::test_is_dict[input_value16-expected16] - AssertionError: assert {'a': 1, 'b': None} == IsIgnoreDict(a=1)
FAILED tests/test_dict.py::test_is_dict[input_value17-expected17] - assert {1: 10, 2: None} == IsIgnoreDict(1=10)
FAILED tests/test_dict.py::test_is_dict[input_value20-expected20] - assert {1: 10, 2: False} == IsIgnoreDict[ignore={False}](1=10)
FAILED tests/test_dict.py::test_callable_ignore - AssertionError: assert {'a': 1, 'b': 42} == IsDict[ignore=ignore_42](a=1)
FAILED tests/test_dict.py::test_ignore - AssertionError: assert {'a': 1, 'b': 2, 'c': 3, 'd': 4} == IsDict[ignore=custom_ignore](a=1...
FAILED tests/test_dict.py::test_ignore_with_is_str - AssertionError: assert {'dob': None, 'id': 123, 'street_address': None, 'token'...
FAILED tests/test_dict.py::test_unhashable_value - AssertionError: assert {'b': {'a': 1}, 'c': None} == IsIgnoreDict(b={'a': 1})
FAILED tests/test_docs.py::test_docs_examples[dirty_equals/_inspection.py:172-189] - AssertionError: assert <_inspection_172_189.Foo...
FAILED tests/test_docs.py::test_docs_examples[dirty_equals/_dict.py:186-204] - AssertionError: assert {'a': 1, 'b': 2, 'c': None} ==...
FAILED tests/test_inspection.py::test_has_attributes[-HasAttributes(a=IsInt, b=IsStr)] - assert <tests.test_inspection.Foo object at...
Full output:
========================================================= test session starts =========================================================
platform linux -- Python 3.9.12[pypy-7.3.9-final], pytest-7.1.2, pluggy-1.0.0
rootdir: /tmp/dirty-equals, configfile: pyproject.toml, testpaths: tests
plugins: forked-1.4.0, xdist-2.5.0, xprocess-0.18.1, anyio-3.5.0
collected 484 items
tests/test_base.py ......F.................... [ 5%]
tests/test_boolean.py ..........................F................ [ 14%]
tests/test_datetime.py ................................................. [ 24%]
tests/test_dict.py ................FF..F................F.................FFF [ 36%]
tests/test_docs.py ..........................F...F.................. [ 46%]
tests/test_inspection.py ................F........... [ 52%]
tests/test_list_tuple.py .............................................................................. [ 68%]
tests/test_numeric.py .......................................................... [ 80%]
tests/test_other.py ................................... [ 87%]
tests/test_strings.py ........................................................... [100%]
============================================================== FAILURES ===============================================================
____________________________________________________________ test_not_repr ____________________________________________________________
def test_not_repr():
v = ~IsInt
assert str(v) == '~IsInt'
with pytest.raises(AssertionError):
> assert 1 == v
E Failed: DID NOT RAISE <class 'AssertionError'>
tests/test_base.py:66: Failed
________________________________________________________ test_dirty_not_equals ________________________________________________________
def test_dirty_not_equals():
with pytest.raises(AssertionError):
> assert 0 != IsFalseLike
E Failed: DID NOT RAISE <class 'AssertionError'>
tests/test_boolean.py:48: Failed
_______________________________________________ test_is_dict[input_value16-expected16] ________________________________________________
input_value = {'a': 1, 'b': None}, expected = IsIgnoreDict(a=1)
@pytest.mark.parametrize(
'input_value,expected',
[
({}, IsDict),
({}, IsDict()),
({'a': 1}, IsDict(a=1)),
({1: 2}, IsDict({1: 2})),
({'a': 1, 'b': 2}, IsDict(a=1, b=2)),
({'b': 2, 'a': 1}, IsDict(a=1, b=2)),
({'a': 1, 'b': None}, IsDict(a=1, b=None)),
({'a': 1, 'b': 3}, ~IsDict(a=1, b=2)),
# partial dict
({1: 10, 2: 20}, IsPartialDict({1: 10})),
({1: 10}, IsPartialDict({1: 10})),
({1: 10, 2: 20}, IsPartialDict({1: 10})),
({1: 10, 2: 20}, IsDict({1: 10}).settings(partial=True)),
({1: 10}, ~IsPartialDict({1: 10, 2: 20})),
({1: 10, 2: None}, ~IsPartialDict({1: 10, 2: 20})),
# ignore dict
({}, IsIgnoreDict()),
({'a': 1, 'b': 2}, IsIgnoreDict(a=1, b=2)),
({'a': 1, 'b': None}, IsIgnoreDict(a=1)),
({1: 10, 2: None}, IsIgnoreDict({1: 10})),
({'a': 1, 'b': 2}, ~IsIgnoreDict(a=1)),
({1: 10, 2: False}, ~IsIgnoreDict({1: 10})),
({1: 10, 2: False}, IsIgnoreDict({1: 10}).settings(ignore={False})),
# strict dict
({}, IsStrictDict()),
({'a': 1, 'b': 2}, IsStrictDict(a=1, b=2)),
({'a': 1, 'b': 2}, ~IsStrictDict(b=2, a=1)),
({1: 10, 2: 20}, IsStrictDict({1: 10, 2: 20})),
({1: 10, 2: 20}, ~IsStrictDict({2: 20, 1: 10})),
({1: 10, 2: 20}, ~IsDict({2: 20, 1: 10}).settings(strict=True)),
# combining types
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(a=1, c=3).settings(partial=True)),
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(a=1, b=2).settings(partial=True)),
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(b=2, c=3).settings(partial=True)),
({'a': 1, 'c': 3, 'b': 2}, ~IsStrictDict(b=2, c=3).settings(partial=True)),
],
)
def test_is_dict(input_value, expected):
> assert input_value == expected
E AssertionError: assert {'a': 1, 'b': None} == IsIgnoreDict(a=1)
tests/test_dict.py:47: AssertionError
_______________________________________________ test_is_dict[input_value17-expected17] ________________________________________________
input_value = {1: 10, 2: None}, expected = IsIgnoreDict(1=10)
@pytest.mark.parametrize(
'input_value,expected',
[
({}, IsDict),
({}, IsDict()),
({'a': 1}, IsDict(a=1)),
({1: 2}, IsDict({1: 2})),
({'a': 1, 'b': 2}, IsDict(a=1, b=2)),
({'b': 2, 'a': 1}, IsDict(a=1, b=2)),
({'a': 1, 'b': None}, IsDict(a=1, b=None)),
({'a': 1, 'b': 3}, ~IsDict(a=1, b=2)),
# partial dict
({1: 10, 2: 20}, IsPartialDict({1: 10})),
({1: 10}, IsPartialDict({1: 10})),
({1: 10, 2: 20}, IsPartialDict({1: 10})),
({1: 10, 2: 20}, IsDict({1: 10}).settings(partial=True)),
({1: 10}, ~IsPartialDict({1: 10, 2: 20})),
({1: 10, 2: None}, ~IsPartialDict({1: 10, 2: 20})),
# ignore dict
({}, IsIgnoreDict()),
({'a': 1, 'b': 2}, IsIgnoreDict(a=1, b=2)),
({'a': 1, 'b': None}, IsIgnoreDict(a=1)),
({1: 10, 2: None}, IsIgnoreDict({1: 10})),
({'a': 1, 'b': 2}, ~IsIgnoreDict(a=1)),
({1: 10, 2: False}, ~IsIgnoreDict({1: 10})),
({1: 10, 2: False}, IsIgnoreDict({1: 10}).settings(ignore={False})),
# strict dict
({}, IsStrictDict()),
({'a': 1, 'b': 2}, IsStrictDict(a=1, b=2)),
({'a': 1, 'b': 2}, ~IsStrictDict(b=2, a=1)),
({1: 10, 2: 20}, IsStrictDict({1: 10, 2: 20})),
({1: 10, 2: 20}, ~IsStrictDict({2: 20, 1: 10})),
({1: 10, 2: 20}, ~IsDict({2: 20, 1: 10}).settings(strict=True)),
# combining types
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(a=1, c=3).settings(partial=True)),
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(a=1, b=2).settings(partial=True)),
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(b=2, c=3).settings(partial=True)),
({'a': 1, 'c': 3, 'b': 2}, ~IsStrictDict(b=2, c=3).settings(partial=True)),
],
)
def test_is_dict(input_value, expected):
> assert input_value == expected
E assert {1: 10, 2: None} == IsIgnoreDict(1=10)
tests/test_dict.py:47: AssertionError
_______________________________________________ test_is_dict[input_value20-expected20] ________________________________________________
input_value = {1: 10, 2: False}, expected = IsIgnoreDict[ignore={False}](1=10)
@pytest.mark.parametrize(
'input_value,expected',
[
({}, IsDict),
({}, IsDict()),
({'a': 1}, IsDict(a=1)),
({1: 2}, IsDict({1: 2})),
({'a': 1, 'b': 2}, IsDict(a=1, b=2)),
({'b': 2, 'a': 1}, IsDict(a=1, b=2)),
({'a': 1, 'b': None}, IsDict(a=1, b=None)),
({'a': 1, 'b': 3}, ~IsDict(a=1, b=2)),
# partial dict
({1: 10, 2: 20}, IsPartialDict({1: 10})),
({1: 10}, IsPartialDict({1: 10})),
({1: 10, 2: 20}, IsPartialDict({1: 10})),
({1: 10, 2: 20}, IsDict({1: 10}).settings(partial=True)),
({1: 10}, ~IsPartialDict({1: 10, 2: 20})),
({1: 10, 2: None}, ~IsPartialDict({1: 10, 2: 20})),
# ignore dict
({}, IsIgnoreDict()),
({'a': 1, 'b': 2}, IsIgnoreDict(a=1, b=2)),
({'a': 1, 'b': None}, IsIgnoreDict(a=1)),
({1: 10, 2: None}, IsIgnoreDict({1: 10})),
({'a': 1, 'b': 2}, ~IsIgnoreDict(a=1)),
({1: 10, 2: False}, ~IsIgnoreDict({1: 10})),
({1: 10, 2: False}, IsIgnoreDict({1: 10}).settings(ignore={False})),
# strict dict
({}, IsStrictDict()),
({'a': 1, 'b': 2}, IsStrictDict(a=1, b=2)),
({'a': 1, 'b': 2}, ~IsStrictDict(b=2, a=1)),
({1: 10, 2: 20}, IsStrictDict({1: 10, 2: 20})),
({1: 10, 2: 20}, ~IsStrictDict({2: 20, 1: 10})),
({1: 10, 2: 20}, ~IsDict({2: 20, 1: 10}).settings(strict=True)),
# combining types
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(a=1, c=3).settings(partial=True)),
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(a=1, b=2).settings(partial=True)),
({'a': 1, 'b': 2, 'c': 3}, IsStrictDict(b=2, c=3).settings(partial=True)),
({'a': 1, 'c': 3, 'b': 2}, ~IsStrictDict(b=2, c=3).settings(partial=True)),
],
)
def test_is_dict(input_value, expected):
> assert input_value == expected
E assert {1: 10, 2: False} == IsIgnoreDict[ignore={False}](1=10)
tests/test_dict.py:47: AssertionError
________________________________________________________ test_callable_ignore _________________________________________________________
def test_callable_ignore():
assert {'a': 1} == IsDict(a=1).settings(ignore=ignore_42)
> assert {'a': 1, 'b': 42} == IsDict(a=1).settings(ignore=ignore_42)
E AssertionError: assert {'a': 1, 'b': 42} == IsDict[ignore=ignore_42](a=1)
E + where IsDict[ignore=ignore_42](a=1) = <bound method IsDict.settings of IsDict(a=1)>(ignore=ignore_42)
E + where <bound method IsDict.settings of IsDict(a=1)> = IsDict(a=1).settings
E + where IsDict(a=1) = IsDict(a=1)
tests/test_dict.py:95: AssertionError
_____________________________________________________________ test_ignore _____________________________________________________________
def test_ignore():
def custom_ignore(v: int) -> bool:
return v % 2 == 0
> assert {'a': 1, 'b': 2, 'c': 3, 'd': 4} == IsDict(a=1, c=3).settings(ignore=custom_ignore)
E AssertionError: assert {'a': 1, 'b': 2, 'c': 3, 'd': 4} == IsDict[ignore=custom_ignore](a=1, c=3)
E + where IsDict[ignore=custom_ignore](a=1, c=3) = <bound method IsDict.settings of IsDict(a=1, c=3)>(ignore=<function test_ignore.<locals>.custom_ignore at 0x00007f313d03a020>)
E + where <bound method IsDict.settings of IsDict(a=1, c=3)> = IsDict(a=1, c=3).settings
E + where IsDict(a=1, c=3) = IsDict(a=1, c=3)
tests/test_dict.py:129: AssertionError
_______________________________________________________ test_ignore_with_is_str _______________________________________________________
def test_ignore_with_is_str():
api_data = {'id': 123, 'token': 't-abc123', 'dob': None, 'street_address': None}
token_is_str = IsStr(regex=r't\-.+')
> assert api_data == IsIgnoreDict(id=IsPositiveInt, token=token_is_str)
E AssertionError: assert {'dob': None, 'id': 123, 'street_address': None, 'token': 't-abc123'} == IsIgnoreDict(id=IsPositiveInt, token=IsStr(regex='t\\-.+'))
E + where IsIgnoreDict(id=IsPositiveInt, token=IsStr(regex='t\\-.+')) = IsIgnoreDict(id=IsPositiveInt, token=IsStr(regex='t\\-.+'))
tests/test_dict.py:136: AssertionError
________________________________________________________ test_unhashable_value ________________________________________________________
def test_unhashable_value():
a = {'a': 1}
api_data = {'b': a, 'c': None}
> assert api_data == IsIgnoreDict(b=a)
E AssertionError: assert {'b': {'a': 1}, 'c': None} == IsIgnoreDict(b={'a': 1})
E + where IsIgnoreDict(b={'a': 1}) = IsIgnoreDict(b={'a': 1})
tests/test_dict.py:143: AssertionError
_______________________________________ test_docs_examples[dirty_equals/_inspection.py:172-189] _______________________________________
module_name = '_inspection_172_189'
source_code = '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\...IsStr)\nassert Foo(1, 2) != HasAttributes(a=1, b=2, c=3)\nassert Foo(1, 2) == HasAttributes(a=1, b=2, spam=AnyThing)\n'
import_execute = <function import_execute.<locals>._import_execute at 0x00007f313da302a0>
def test_docs_examples(module_name, source_code, import_execute):
> import_execute(module_name, source_code, True)
tests/test_docs.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_docs.py:25: in _import_execute
spec.loader.exec_module(module)
/usr/lib/pypy3.9/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
exec(co, module.__dict__)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from dirty_equals import HasAttributes, IsInt, IsStr, AnyThing
class Foo:
def __init__(self, a, b):
self.a = a
self.b = b
def spam(self):
pass
assert Foo(1, 2) == HasAttributes(a=1, b=2)
assert Foo(1, 2) == HasAttributes(a=1)
> assert Foo(1, 's') == HasAttributes(a=IsInt, b=IsStr)
E AssertionError: assert <_inspection_172_189.Foo object at 0x00007f313d70b750> == HasAttributes(a=IsInt, b=IsStr)
E + where <_inspection_172_189.Foo object at 0x00007f313d70b750> = <class '_inspection_172_189.Foo'>(1, 's')
E + and HasAttributes(a=IsInt, b=IsStr) = HasAttributes(a=IsInt, b=IsStr)
../pytest-of-mgorny/pytest-15/test_docs_examples_dirty_equal26/_inspection_172_189.py:185: AssertionError
__________________________________________ test_docs_examples[dirty_equals/_dict.py:186-204] __________________________________________
module_name = '_dict_186_204'
source_code = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\...(a=1, c=3).settings(strict=True)\nassert {'b': None, 'c': 3, 'a': 1} != IsIgnoreDict(a=1, c=3).settings(strict=True)\n"
import_execute = <function import_execute.<locals>._import_execute at 0x00007f313f1be2a0>
def test_docs_examples(module_name, source_code, import_execute):
> import_execute(module_name, source_code, True)
tests/test_docs.py:69:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_docs.py:25: in _import_execute
spec.loader.exec_module(module)
/usr/lib/pypy3.9/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
exec(co, module.__dict__)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from dirty_equals import IsIgnoreDict
> assert {'a': 1, 'b': 2, 'c': None} == IsIgnoreDict(a=1, b=2)
E AssertionError: assert {'a': 1, 'b': 2, 'c': None} == IsIgnoreDict(a=1, b=2)
E + where IsIgnoreDict(a=1, b=2) = IsIgnoreDict(a=1, b=2)
../pytest-of-mgorny/pytest-15/test_docs_examples_dirty_equal30/_dict_186_204.py:189: AssertionError
________________________________________ test_has_attributes[-HasAttributes(a=IsInt, b=IsStr)] ________________________________________
value = <tests.test_inspection.Foo object at 0x00007f313eb0bc20>, dirty = HasAttributes(a=IsInt, b=IsStr)
@pytest.mark.parametrize(
'value,dirty',
[
(Foo(1, 2), HasAttributes(a=1, b=2)),
(Foo(1, 's'), HasAttributes(a=IsInt, b=IsStr)),
(Foo(1, 2), ~HasAttributes(a=IsInt, b=IsStr)),
(Foo(1, 2), ~HasAttributes(a=1, b=2, c=3)),
(Foo(1, 2), HasAttributes(a=1, b=2, spam=AnyThing)),
(Foo(1, 2), ~HasAttributes(a=1, b=2, missing=AnyThing)),
],
ids=dirty_repr,
)
def test_has_attributes(value, dirty):
> assert value == dirty
E assert <tests.test_inspection.Foo object at 0x00007f313eb0bc20> == HasAttributes(a=IsInt, b=IsStr)
tests/test_inspection.py:86: AssertionError
======================================================= short test summary info =======================================================
FAILED tests/test_base.py::test_not_repr - Failed: DID NOT RAISE <class 'AssertionError'>
FAILED tests/test_boolean.py::test_dirty_not_equals - Failed: DID NOT RAISE <class 'AssertionError'>
FAILED tests/test_dict.py::test_is_dict[input_value16-expected16] - AssertionError: assert {'a': 1, 'b': None} == IsIgnoreDict(a=1)
FAILED tests/test_dict.py::test_is_dict[input_value17-expected17] - assert {1: 10, 2: None} == IsIgnoreDict(1=10)
FAILED tests/test_dict.py::test_is_dict[input_value20-expected20] - assert {1: 10, 2: False} == IsIgnoreDict[ignore={False}](1=10)
FAILED tests/test_dict.py::test_callable_ignore - AssertionError: assert {'a': 1, 'b': 42} == IsDict[ignore=ignore_42](a=1)
FAILED tests/test_dict.py::test_ignore - AssertionError: assert {'a': 1, 'b': 2, 'c': 3, 'd': 4} == IsDict[ignore=custom_ignore](a=1...
FAILED tests/test_dict.py::test_ignore_with_is_str - AssertionError: assert {'dob': None, 'id': 123, 'street_address': None, 'token'...
FAILED tests/test_dict.py::test_unhashable_value - AssertionError: assert {'b': {'a': 1}, 'c': None} == IsIgnoreDict(b={'a': 1})
FAILED tests/test_docs.py::test_docs_examples[dirty_equals/_inspection.py:172-189] - AssertionError: assert <_inspection_172_189.Foo...
FAILED tests/test_docs.py::test_docs_examples[dirty_equals/_dict.py:186-204] - AssertionError: assert {'a': 1, 'b': 2, 'c': None} ==...
FAILED tests/test_inspection.py::test_has_attributes[-HasAttributes(a=IsInt, b=IsStr)] - assert <tests.test_inspection.Foo object at...
=================================================== 12 failed, 472 passed in 3.99s ====================================================