alexmojaki / cheap_repr

Better version of repr/reprlib for short, cheap string representations in Python
MIT License
23 stars 5 forks source link

AssertionError: 'OrderedDict([(0, 0), (1, 2), (2, 4)])' != 'OrderedDict({0: 0, 1: 2, 2: 4})' #26

Closed carlosal1015 closed 2 months ago

carlosal1015 commented 3 months ago

Hi, with python 3.12.4 I run the test but is not passing. I am using the latest version 0.5.1.

===================================================================== test session starts ======================================================================
platform linux -- Python 3.12.4, pytest-8.3.2, pluggy-1.5.0
rootdir: /tmp/makepkg/python-cheap_repr/src/cheap_repr-0.5.1
configfile: pyproject.toml
plugins: typeguard-4.3.0
collected 27 items                                                                                                                                             

tests/test_cheap_repr.py .................sF........                                                                                                     [100%]

=========================================================================== FAILURES ===========================================================================
_______________________________________________________________ TestCheapRepr.test_ordered_dict ________________________________________________________________

self = <tests.test_cheap_repr.TestCheapRepr testMethod=test_ordered_dict>

    def test_ordered_dict(self):
        self.assert_usual_repr(OrderedDict())
>       self.assert_usual_repr(OrderedDict((x, x * 2) for x in range(3)))

tests/test_cheap_repr.py:218: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_cheap_repr.py:121: in assert_usual_repr
    self.assert_cheap_repr(x, expected)
tests/test_cheap_repr.py:115: in assert_cheap_repr
    self.assertEqual(actual, expected_repr)
E   AssertionError: 'OrderedDict([(0, 0), (1, 2), (2, 4)])' != 'OrderedDict({0: 0, 1: 2, 2: 4})'
E   - OrderedDict([(0, 0), (1, 2), (2, 4)])
E   + OrderedDict({0: 0, 1: 2, 2: 4})
======================================================================= warnings summary =======================================================================
tests/test_cheap_repr.py::TestCheapRepr::test_django_queryset
  /usr/lib/python3.12/site-packages/django/conf/__init__.py:241: RemovedInDjango50Warning: The default value of USE_TZ will change from False to True in Django 5.0. Set USE_TZ to False in your project settings if you want to keep the current default behavior.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================== short test summary info ====================================================================
FAILED tests/test_cheap_repr.py::TestCheapRepr::test_ordered_dict - AssertionError: 'OrderedDict([(0, 0), (1, 2), (2, 4)])' != 'OrderedDict({0: 0, 1: 2, 2: 4})'
====================================================== 1 failed, 25 passed, 1 skipped, 1 warning in 0.55s ======================================================
alexmojaki commented 2 months ago

Thanks, fixed in https://github.com/alexmojaki/cheap_repr/commit/df9bf547e8b4b30f3f1a3ba3537de6cad97ee6e9, released in version 0.5.2