Skip to content

fix(#895): Add tests for IEEE 754 special floats in parse_token_int()#899

Merged
microsasa merged 1 commit intomainfrom
fix/895-ieee754-special-float-tests-3b93b6f2492fd6cc
Apr 10, 2026
Merged

fix(#895): Add tests for IEEE 754 special floats in parse_token_int()#899
microsasa merged 1 commit intomainfrom
fix/895-ieee754-special-float-tests-3b93b6f2492fd6cc

Conversation

@microsasa
Copy link
Copy Markdown
Owner

Summary

Add test coverage for IEEE 754 special floats (inf, -inf, nan) and -0.0 in parse_token_int() and the AssistantMessageData Pydantic boundary validator.

These values are already handled correctly by the implementation but had no regression tests documenting the expected behavior.

Tests added

TestParseTokenInt:

  • test_special_float_returns_none -- parametrized with float('inf'), float('-inf'), float('nan')
  • test_negative_zero_float_returns_none -- verifies -0.0 is rejected

TestSanitizeNonNumericTokens:

  • test_special_float_maps_to_zero -- parametrized with float('inf'), float('-inf'), float('nan')
  • test_negative_zero_float_maps_to_zero -- verifies -0.0 maps to 0

Closes #895

Generated by Issue Implementer · ● 8.7M ·

Add coverage for float('inf'), float('-inf'), float('nan'), and -0.0
in both parse_token_int() (TestParseTokenInt) and the Pydantic
boundary validator (TestSanitizeNonNumericTokens).

These values are already handled correctly by the implementation but
had no regression tests documenting the expected behavior.

Closes #895

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@microsasa microsasa added the aw Created by agentic workflow label Apr 10, 2026
@microsasa microsasa enabled auto-merge April 10, 2026 09:18
Copilot AI review requested due to automatic review settings April 10, 2026 09:18
@microsasa microsasa added the aw Created by agentic workflow label Apr 10, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds regression coverage for edge-case IEEE 754 float values at both the parse_token_int() helper layer and the AssistantMessageData.outputTokens Pydantic boundary validator, ensuring special floats are rejected/normalized as intended.

Changes:

  • Added parametrized tests asserting parse_token_int() rejects inf, -inf, nan, and -0.0.
  • Added validator tests asserting AssistantMessageData.model_validate({"outputTokens": ...}) maps those same values to 0.

@microsasa microsasa added the aw-quality-gate-approved Quality gate approved the PR label Apr 10, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Low-impact test-only addition with good coverage. Adds regression tests for IEEE 754 special floats (inf, -inf, nan) and -0.0 in both parse_token_int() and the AssistantMessageData Pydantic boundary validator. Tests are well-structured, follow existing patterns, and verify correct behavior against the implementation. All 8 CI checks pass. Auto-approving for merge.

@microsasa microsasa merged commit 3be35c4 into main Apr 10, 2026
8 checks passed
@microsasa microsasa deleted the fix/895-ieee754-special-float-tests-3b93b6f2492fd6cc branch April 10, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aw Created by agentic workflow aw-quality-gate-approved Quality gate approved the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw][test audit] parse_token_int() has no coverage for IEEE 754 special floats (inf, nan, -0.0)

2 participants