python-poetry / tomlkit

Style-preserving TOML library for Python
MIT License
701 stars 99 forks source link

Test failures with Python 3.13.0a4: test_dates_behave_like_dates and test_times_behave_like_times #333

Closed befeleme closed 6 months ago

befeleme commented 9 months ago

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:

mgorny commented 6 months ago

This is still happening with 3.13.0b1.