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 2025/06/23 05:36:58 UTC
(hamilton) 08/14: Removed 'future' type annotations for backward compatibility
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 da6d1fa943ad9c0e877a29f2dc9f715ac82b6345
Author: Charles Swartz <ch...@gmail.com>
AuthorDate: Sun Apr 6 10:08:56 2025 -0400
Removed 'future' type annotations for backward compatibility
---
tests/function_modifiers/test_expanders.py | 46 ++----------------------------
1 file changed, 2 insertions(+), 44 deletions(-)
diff --git a/tests/function_modifiers/test_expanders.py b/tests/function_modifiers/test_expanders.py
index 6c1304da..2e41494c 100644
--- a/tests/function_modifiers/test_expanders.py
+++ b/tests/function_modifiers/test_expanders.py
@@ -553,25 +553,6 @@ def test_unpack_fields_valid_indeterminate_tuple():
assert nodes[3].input_types == {dummy.__name__: (Tuple[int, ...], DependencyType.REQUIRED)}
-@pytest.mark.skipif(
- sys.version_info < (3, 10), reason="Python 3.9+ required for modern tuple syntax"
-)
-@pytest.mark.parametrize(
- "return_type,fields",
- [
- (tuple[int, int], ("A", "B")),
- (tuple[int, int, str], ("A", "B", "C")),
- (tuple[int, int, str], ("A", "B", "C")),
- ],
-)
-def test_unpack_fields_valid_type_annotation(return_type, fields):
- def function() -> return_type:
- return 1, 2, "3" # Only testing validation, so return value doesn't matter
-
- annotation = function_modifiers.unpack_fields(*fields)
- annotation.validate(function)
-
-
@pytest.mark.parametrize(
"return_type,fields",
[
@@ -580,7 +561,7 @@ def test_unpack_fields_valid_type_annotation(return_type, fields):
(Tuple[int, int, str], ("A", "B", "C")),
],
)
-def test_unpack_fields_valid_type_annotations_legacy(return_type, fields):
+def test_unpack_fields_valid_type_annotations(return_type, fields):
def function() -> return_type:
return 1, 2, "3" # Only testing validation, so return value doesn't matter
@@ -588,29 +569,6 @@ def test_unpack_fields_valid_type_annotations_legacy(return_type, fields):
annotation.validate(function)
-@pytest.mark.skipif(
- sys.version_info < (3, 10), reason="Python 3.9+ required for modern tuple syntax"
-)
-@pytest.mark.parametrize(
- "return_type,fields",
- [
- (int, ("A",)),
- (list, ("A",)),
- (dict, ("A",)),
- (tuple, ("A",)),
- (tuple[...], ("A", "B")),
- (tuple[int, int], ("A", "B", "C", "D")),
- ],
-)
-def test_unpack_fields_invalid_type_annotations(return_type, fields):
- def function() -> return_type:
- return 1, 2, 3 # Only testing validation, so return value doesn't matter
-
- annotation = function_modifiers.unpack_fields(*fields)
- with pytest.raises(hamilton.function_modifiers.base.InvalidDecoratorException):
- annotation.validate(function)
-
-
@pytest.mark.parametrize(
"return_type,fields",
[
@@ -622,7 +580,7 @@ def test_unpack_fields_invalid_type_annotations(return_type, fields):
(Tuple[int, int], ("A", "B", "C", "D")),
],
)
-def test_unpack_fields_invalid_type_annotations_legacy(return_type, fields):
+def test_unpack_fields_invalid_type_annotations(return_type, fields):
def function() -> return_type:
return 1, 2, 3 # Only testing validation, so return value doesn't matter