Skip to content

Commit 5c426eb

Browse files
committed
fix: resolve all linting and formatting issues
- Convert Optional[str] to str | None syntax (Python 3.10+) - Convert Union[str, bytes] to str | bytes syntax - Fix isinstance checks to use union type syntax - Apply consistent formatting across all integration test files This should resolve all CI linting failures.
1 parent 3d0358c commit 5c426eb

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

tests/integration/test_direct_api_integration.py

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

7-
from typing import Optional, Union
8-
97
import pytest
108

119
from nutrient_dws import NutrientClient
1210

1311
try:
1412
from . import integration_config # type: ignore[attr-defined]
1513

16-
API_KEY: Optional[str] = integration_config.API_KEY
17-
BASE_URL: Optional[str] = getattr(integration_config, "BASE_URL", None)
14+
API_KEY: str | None = integration_config.API_KEY
15+
BASE_URL: str | None = getattr(integration_config, "BASE_URL", None)
1816
TIMEOUT: int = getattr(integration_config, "TIMEOUT", 60)
1917
except ImportError:
2018
API_KEY = None
2119
BASE_URL = None
2220
TIMEOUT = 60
2321

2422

25-
def assert_is_pdf(file_path_or_bytes: Union[str, bytes]) -> None:
23+
def assert_is_pdf(file_path_or_bytes: str | bytes) -> None:
2624
"""Assert that a file or bytes is a valid PDF.
2725
2826
Args:
2927
file_path_or_bytes: Path to file or bytes content to check.
3028
"""
31-
if isinstance(file_path_or_bytes, (str, bytes)):
29+
if isinstance(file_path_or_bytes, str | bytes):
3230
if isinstance(file_path_or_bytes, str):
3331
with open(file_path_or_bytes, "rb") as f:
3432
content = f.read(8)

tests/integration/test_live_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def assert_is_pdf(file_path_or_bytes: str | bytes) -> None:
2727
Args:
2828
file_path_or_bytes: Path to file or bytes content to check.
2929
"""
30-
if isinstance(file_path_or_bytes, (str, bytes)):
30+
if isinstance(file_path_or_bytes, str | bytes):
3131
if isinstance(file_path_or_bytes, str):
3232
with open(file_path_or_bytes, "rb") as f:
3333
content = f.read(8)

tests/integration/test_smoke.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
"""Basic smoke test to validate integration test setup."""
22

3-
from typing import Optional
4-
53
import pytest
64

75
from nutrient_dws import NutrientClient
86

97
# Type annotation for mypy
10-
API_KEY: Optional[str] = None
8+
API_KEY: str | None = None
119

1210
try:
1311
from . import integration_config # type: ignore[attr-defined]

0 commit comments

Comments
 (0)