Repository navigation
Conversation
Wkhanex
reviewed
Oct 13, 2026
There was a problem hiding this comment.
Nine reflected-addition checks passed for dates, offset datetimes and local datetimes, including negative one-day, positive one-day and 27-hour-plus-one-microsecond deltas. I used Python 3.12.14 against commit 0b667c6.
For every case, delta + item and item + delta had the same TOML class, value and as_string output. Assigning the reflected result back into a commented document produced valid TOML with the comment intact, and stdlib tomllib decoded the expected temporal value. This checks the document-assignment path as well as the numeric result. I ran standalone assertions against fetched PR source; I did not run the full pytest suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
timedelta + Datereturns the correct date with an empty serialized value, so assigning it back to a document produces invalid TOML.timedelta + DateTimeformats correctly but loses its original trivia. Both operations bypass the wrappers' existing addition methods.Route reflected addition through the existing wrapped addition for both temporal types. Six cases cover forward/backward shifts of dates and naive/aware datetimes, matching ordinary addition's value, text and trivia and round-tripping the resulting document.
Validation: all six regressions fail on the unchanged source; all 1190 tests including conformance fixtures and applicable pre-commit checks pass after the change. The six existing Mypy diagnostics remain unchanged from the exact base, allowing for shifted line numbers.
Agent Drafting Metadata
tomlkit/items.py,tests/test_items.pyandCHANGELOG.mdwere prepared with this agent.