Skip to content

Fix fraction dropping leading zeros - #11

Merged
DavidMStraub merged 2 commits into
mainfrom
fix_fraction
Aug 13, 2026
Merged

Fix fraction dropping leading zeros#11
DavidMStraub merged 2 commits into
mainfrom
fix_fraction

Conversation

@DavidMStraub

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes incorrect handling of fractional seconds where leading zeros were being dropped (e.g., interpreting .05 as .5) by preserving the fraction digits verbatim as a string throughout parsing and conversions.

Changes:

  • Change types.Time.fraction from int | None to str | None and document why the digits are preserved verbatim.
  • Update _cast_time to keep the captured fraction substring instead of casting it to int.
  • Update and extend tests to ensure fraction width/leading zeros are preserved and remain semantically significant.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
gedcom7/types.py Updates Time.fraction type to `str
gedcom7/cast.py Preserves the fraction group as a string when casting time values.
test/test_util.py Updates fraction inputs to strings and adds a test asserting leading-zero significance.
test/test_cast.py Updates time-casting expectations and adds a test for preserving fraction text width.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread gedcom7/types.py Outdated
Comment thread test/test_util.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@DavidMStraub
DavidMStraub merged commit 3c1e8e7 into main Aug 13, 2026
7 checks passed
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.

2 participants