fix: use pre-3.10 type annotations for compatibility#200
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts type annotations in Azure session tests to use pre-3.10 typing syntax for compatibility with Python 3.9 and earlier. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Replace PEP 604 union syntax (bytes | None) and builtin generic types (tuple[], type[]) with their typing module equivalents (Optional, Tuple, Type) in test_session.py to support Python versions older than 3.10. Refers to SPSTRAT-731 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
If we want to support 3.9 tahn we shdoul also test it :-) Shall we revert f922a43 |
|
@lslebodn is it ok to just change the annotations and keep 3.9 dropped? I can then update It won't solve 3.9 issues but we'll be more consistent. I'll also close #201 since it will be a mess to add back an EOL version |
|
|
||
|
|
||
| def _sequential_http_handler( | ||
| responses: List[Tuple[int, bytes | None]], |
There was a problem hiding this comment.
from __future__ import annotations should help to keep simplified syntax introduced in https://peps.python.org/pep-0604/.
Cause it makes all annotations strings (PEP 563 deferred evaluation) rather than
evaluating them eagerly. But I would prefer to have deferred just in 3.9
And we should test it with python3.9 anyway.
Summary
bytes | None) withOptional[bytes]intests/ms_azure/test_session.pytuple[],type[]) withtypingequivalents (Tuple,Type) for Python < 3.10 compatibilityRefers to SPSTRAT-731
Test plan
🤖 Generated with Claude Code
Summary by Sourcery
Update Azure session tests to use pre-3.10 compatible type annotations.
Enhancements:
Tests: