Skip to content

Commit 5c75ff3

Browse files
committed
fix: add Python 3.9 compatibility to remaining integration test file
- Fix union type syntax in test_direct_api_integration.py - Ensures all test files work with Python 3.9+ - Completes Python 3.9 compatibility across entire codebase
1 parent 827f2fb commit 5c75ff3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/integration/test_direct_api_integration.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,31 @@
44
test all Direct API methods against the live Nutrient DWS API.
55
"""
66

7+
from typing import Union, Optional
8+
79
import pytest
810

911
from nutrient_dws import NutrientClient
1012

1113
try:
1214
from . import integration_config # type: ignore[attr-defined]
1315

14-
API_KEY: str | None = integration_config.API_KEY
15-
BASE_URL: str | None = getattr(integration_config, "BASE_URL", None)
16+
API_KEY: Optional[str] = integration_config.API_KEY
17+
BASE_URL: Optional[str] = getattr(integration_config, "BASE_URL", None)
1618
TIMEOUT: int = getattr(integration_config, "TIMEOUT", 60)
1719
except ImportError:
1820
API_KEY = None
1921
BASE_URL = None
2022
TIMEOUT = 60
2123

2224

23-
def assert_is_pdf(file_path_or_bytes: str | bytes) -> None:
25+
def assert_is_pdf(file_path_or_bytes: Union[str, bytes]) -> None:
2426
"""Assert that a file or bytes is a valid PDF.
2527
2628
Args:
2729
file_path_or_bytes: Path to file or bytes content to check.
2830
"""
29-
if isinstance(file_path_or_bytes, str | bytes):
31+
if isinstance(file_path_or_bytes, (str, bytes)):
3032
if isinstance(file_path_or_bytes, str):
3133
with open(file_path_or_bytes, "rb") as f:
3234
content = f.read(8)

0 commit comments

Comments
 (0)