Skip to content

Commit af3a56a

Browse files
Fix type checker issues in parallel tests using cast instead of type ignore
Amp-Thread-ID: https://ampcode.com/threads/T-17f644e1-8fd3-4bb2-b2c6-bcb9119cfc98 Co-authored-by: Amp <[email protected]>
1 parent 76257e5 commit af3a56a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/test_parallel.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Tests for parallel processing functionality."""
2-
from typing import TYPE_CHECKING
2+
from typing import TYPE_CHECKING, Any, Sequence, cast
33

44
import pytest
55

@@ -72,13 +72,13 @@ def test_parallel_dict_invalid_input(self) -> None:
7272
invalid_data = ["not", "a", "dict"]
7373
with pytest.raises(TypeError):
7474
convert_dict_parallel(
75-
invalid_data, [], "root", True, dicttoxml.default_item_func, False, True, False, workers=2 # type: ignore
75+
cast(dict[str, Any], invalid_data), [], "root", True, dicttoxml.default_item_func, False, True, False, workers=2
7676
)
7777

7878
# Passing None
7979
with pytest.raises(TypeError):
8080
convert_dict_parallel(
81-
None, [], "root", True, dicttoxml.default_item_func, False, True, False, workers=2 # type: ignore
81+
cast(dict[str, Any], None), [], "root", True, dicttoxml.default_item_func, False, True, False, workers=2
8282
)
8383

8484
def test_parallel_list_invalid_input(self) -> None:
@@ -87,13 +87,13 @@ def test_parallel_list_invalid_input(self) -> None:
8787
invalid_data = {"not": "a list"}
8888
with pytest.raises(TypeError):
8989
convert_list_parallel(
90-
invalid_data, [], "root", True, dicttoxml.default_item_func, False, True, False, workers=2, chunk_size=100 # type: ignore
90+
cast(Sequence[Any], invalid_data), [], "root", True, dicttoxml.default_item_func, False, True, False, workers=2, chunk_size=100
9191
)
9292

9393
# Passing None
9494
with pytest.raises(TypeError):
9595
convert_list_parallel(
96-
None, [], "root", True, dicttoxml.default_item_func, False, True, False, workers=2, chunk_size=100 # type: ignore
96+
cast(Sequence[Any], None), [], "root", True, dicttoxml.default_item_func, False, True, False, workers=2, chunk_size=100
9797
)
9898

9999
def test_parallel_list_small(self) -> None:

0 commit comments

Comments
 (0)