tomlkit icon indicating copy to clipboard operation
tomlkit copied to clipboard

Test failures with Python 3.13.0a4: test_dates_behave_like_dates and test_times_behave_like_times

Open befeleme opened this issue 6 months ago • 0 comments

The failures:

=================================== FAILURES ===================================
_________________________ test_dates_behave_like_dates _________________________

    def test_dates_behave_like_dates():
        i = item(date(2018, 7, 22))
    
        assert i == date(2018, 7, 22)
        assert i.as_string() == "2018-07-22"
    
        i += timedelta(days=1)
>       assert i == datetime(2018, 7, 23)
E       assert Date(2018, 7, 23) == datetime.datetime(2018, 7, 23, 0, 0)
E        +  where datetime.datetime(2018, 7, 23, 0, 0) = datetime(2018, 7, 23)

tests/test_items.py:692: AssertionError
_________________________ test_times_behave_like_times _________________________

    def test_times_behave_like_times():
        i = item(time(12, 34, 56))
    
        assert i == time(12, 34, 56)
        assert i.as_string() == "12:34:56"
    
>       i = i.replace(hour=13)

tests/test_items.py:726: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Time(12, 34, 56), args = (), kwargs = {'hour': 13}

    def replace(self, *args: Any, **kwargs: Any) -> time:
>       return self._new(super().replace(*args, **kwargs))
E       TypeError: Time.__init__() missing 2 required positional arguments: 'trivia' and 'raw'

tomlkit/items.py:1071: TypeError
=========================== short test summary info ============================
FAILED tests/test_items.py::test_dates_behave_like_dates - assert Date(2018, ...
FAILED tests/test_items.py::test_times_behave_like_times - TypeError: Time.__...
======================== 2 failed, 851 passed in 3.36s =========================

The changes around datetime and time in Python 3.13:

  • time: https://github.com/python/cpython/pull/114780
  • (possibly) date: https://github.com/python/cpython/pull/114760

befeleme avatar Feb 21 '24 10:02 befeleme