Skip to content

test: make datetime compliance expectations independent - #604

Open
xuu33030 wants to merge 1 commit into
python-poetry:masterfrom
xuu33030:test/603-independent-datetime-oracle
Open

xuu33030 wants to merge 1 commit into
python-poetry:masterfrom
xuu33030:test/603-independent-datetime-oracle

Conversation

@xuu33030

Copy link
Copy Markdown

Summary

The toml-test datetime expectations currently use parse_rfc3339, the same function used by the parser. A parsing regression can therefore change both actual and expected values without failing compliance tests.

  • Use standard-library datetime, date, and time constructors via fromisoformat for the four datetime-related JSON types.
  • Normalize UTC Z and fractional-second precision for Python 3.9/3.10 compatibility.
  • Add explicit positive and negative nonzero-minute offset cases (+05:30 and -03:30).

No production behavior or dependencies change. Addresses the datetime-oracle and minute-offset coverage gaps in #603; the separately mentioned unwrap() value assertions are not included.

Verification

  • macOS / Python 3.11.15: python -m pytest -q tests — 1,060 passed.
  • macOS / Python 3.9.6: python -m pytest -q -rs tests — 1,059 passed, 1 existing skip (integer-string digit-limit test requires 3.9.14+).
  • Ruff 0.15.21 check and format check on both changed files — passed.
  • git diff --check — passed.
  • mypy tomlkit tests reports the same 29 pre-existing errors in four unchanged files before and after the patch (including the toml-test generator).

Tests used pytest 7.4.4, an explicit local --basetemp, and direct pytest invocation rather than a full Poetry development install. Other platform/Python combinations have not been tested locally.

Mutation checks were run in disposable copies, with the production source left unchanged:

Deliberate mutation Before this patch After this patch
Do not negate negative timezone offsets All 680 compliance cases pass 7 compliance cases fail
Drop timezone offset minutes All 1,058 tests pass Both new offset cases fail

These mutations demonstrate test sensitivity, not existing production parser bugs.

Agent Drafting Metadata

  • Agent: Hermes Agent
  • Model: gpt-6-astra (provider: cockpittools)
  • Notes: The agent investigated the issue, drafted the test changes and PR text, and executed local tests and mutation checks. The repository owner authorized publication. This disclosure does not claim independent human code review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant