Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
befeleme opened this issue Feb 21, 2024 · 1 comment · Fixed by #349
Assignees

Comments

@befeleme
Copy link

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
Copy link

mgorny commented May 12, 2024

This is still happening with 3.13.0b1.

@frostming frostming self-assigned this May 13, 2024
frostming added a commit that referenced this issue May 13, 2024
… and test_times_behave_like_times

Fixes #333

Signed-off-by: Frost Ming <me@frostming.com>
frostming added a commit that referenced this issue May 13, 2024
… and test_times_behave_like_times (#349)

Fixes #333

Signed-off-by: Frost Ming <me@frostming.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants