You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hamilton.apache.org by sk...@apache.org on 2026/02/17 04:18:50 UTC
(hamilton) 01/06: Remove tests for pre-3.9 types (Dict, Tuple)
This is an automated email from the ASF dual-hosted git repository.
skrawcz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hamilton.git
commit 357a43ac812109eb8296fd895354cfa1694a0a29
Author: Dev-iL <65...@users.noreply.github.com>
AuthorDate: Sat Feb 14 16:57:11 2026 +0200
Remove tests for pre-3.9 types (Dict, Tuple)
---
tests/function_modifiers/test_expanders.py | 18 +-----------------
tests/test_type_utils.py | 3 +--
2 files changed, 2 insertions(+), 19 deletions(-)
diff --git a/tests/function_modifiers/test_expanders.py b/tests/function_modifiers/test_expanders.py
index 7a9942ca..55ae3718 100644
--- a/tests/function_modifiers/test_expanders.py
+++ b/tests/function_modifiers/test_expanders.py
@@ -367,9 +367,6 @@ class MyDictInheritanceBadCase(TypedDict):
@pytest.mark.parametrize(
"return_type_str,fields",
[
- ("Dict[str, int]", ("A", "B")),
- ("Dict[str, int]", (["A", "B"])),
- ("Dict", {"A": str, "B": int}),
("MyDict", ()),
("MyDict", {"test2": str}),
("MyDictInheritance", {"test": InheritedObject}),
@@ -394,10 +391,6 @@ def test_extract_fields_valid_annotations_for_inferred_types(return_type_str, fi
@pytest.mark.parametrize(
"return_type_str,fields",
[
- ("Dict", ("A", "B")),
- ("Dict", (["A", "B"])),
- ("Dict", (["A"])),
- ("Dict", (["A", "B", "C"])),
("int", {"A": int}),
("list", {"A": int}),
("np.ndarray", {"A": int}),
@@ -774,9 +767,6 @@ def test_unpack_fields_transform_on_indeterminate_tuple():
@pytest.mark.parametrize(
"return_type_str,fields",
[
- ("Tuple[int, int]", ("A", "B")),
- ("Tuple[int, int, str]", ("A", "B", "C")),
- ("Tuple[int, ...]", ("A", "B")),
("tuple[int, int]", ("A", "B")),
("tuple[int, int, str]", ("A", "B", "C")),
("tuple[int, ...]", ("A", "B")),
@@ -798,11 +788,6 @@ def test_unpack_fields_valid_type_annotations(return_type_str, fields):
("int", ("A",)),
("list", ("A",)),
("dict", ("A",)),
- ("Tuple", ("A",)),
- ("Tuple[int, int]", ("A", "B", "C")),
- pytest.param("Tuple[...]", ("A", "B", "C"), marks=skipif(**prior_to_py311)),
- pytest.param("Tuple[int, int, ...]", ("A", "B"), marks=skipif(**prior_to_py311)),
- pytest.param("Tuple[..., int, int]", ("A", "B"), marks=skipif(**prior_to_py311)),
("tuple", ("A",)),
("tuple[int, int]", ("A", "B", "C")),
("tuple[...]", ("A", "B", "C")),
@@ -811,8 +796,7 @@ def test_unpack_fields_valid_type_annotations(return_type_str, fields):
],
)
def test_unpack_fields_invalid_type_annotations(return_type_str, fields):
- # NOTE: Prior to Python 3.11, improper use of the ellipsis in a typing.Tuple was an error.
- # However, improper use of an ellipsis in a (bare) tuple (python 3.9+) was not an error.
+ # Note: improper use of an ellipsis in a (bare) tuple (python 3.9+) is not an error.
return_type = eval(return_type_str)
diff --git a/tests/test_type_utils.py b/tests/test_type_utils.py
index fd343860..9931b246 100644
--- a/tests/test_type_utils.py
+++ b/tests/test_type_utils.py
@@ -149,12 +149,11 @@ def test_validate_types_sad(type_):
@pytest.mark.parametrize(
"candidate,type_,expected",
[
- (int, int, True),
+ (int, int, True), # a class is always a subclass of itself.
(int, float, False),
# Not safe so we return false
(list[int], list, False),
(frozenset[int], set[int], False),
- (dict, dict, False),
],
)
def test__safe_subclass(candidate, type_, expected):