Skip to content

Add Python SDK mock API tests for encode/duration lossy scenarios - #11053

Merged
Yuchao Yan (msyyc) merged 4 commits into
mainfrom
copilot/add-test-case-for-pull-10835
Jun 24, 2026
Merged

Yuchao Yan (msyyc) merged 4 commits into
mainfrom
copilot/add-test-case-for-pull-10835

Conversation

Copilot AI commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Adds test coverage for the Spector cases introduced in #10835, which verify that durations with fractional precision beyond the target integer encoding are serialized as integers (not floats).

  • Tests: Added test_lossy (sync + async) to both azure and unbranded test_encode_duration files, covering int_seconds (36.25s → int32) and int_milliseconds (36250.25ms → int32)
  • Dependency: Bumped @typespec/http-specs to 0.1.0-alpha.39-dev.2 which includes the lossy duration scenarios
  • Changelog: Added internal changeset
def test_lossy(client: DurationClient):
    client.lossy.int_seconds(input=datetime.timedelta(seconds=36.25))
    client.lossy.int_milliseconds(input=datetime.timedelta(milliseconds=36250.25))

Add sync and async tests for the Encode_Duration_Lossy_intSeconds and
Encode_Duration_Lossy_intMilliseconds Spector scenarios (from PR #10835)
in both azure and unbranded test flavors. Bump @typespec/http-specs to
0.1.0-alpha.39-dev.2 which includes the lossy duration scenarios.

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label Jun 23, 2026
Copilot AI changed the title [WIP] Add test case for pull request 10835 Add Python SDK mock API tests for encode/duration lossy scenarios Jun 23, 2026
Copilot AI requested a review from Yuchao Yan (msyyc) June 23, 2026 09:26
@msyyc
Yuchao Yan (msyyc) marked this pull request as ready for review June 24, 2026 02:22
@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@11053

commit: 7480c79

@github-actions

github-actions Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/http-client-python
Show changes

@typespec/http-client-python - internal ✏️

Add mock API test cases for encode/duration lossy scenarios (int32-seconds and int32-milliseconds) verifying that durations with fractional precision are serialized as integers

@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@msyyc
Yuchao Yan (msyyc) added this pull request to the merge queue Jun 24, 2026
Merged via the queue into main with commit f692a94 Jun 24, 2026
36 checks passed
@msyyc
Yuchao Yan (msyyc) deleted the copilot/add-test-case-for-pull-10835 branch June 24, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants