From 7e380e284853559bb468fde524d530830bbc845a Mon Sep 17 00:00:00 2001 From: Michael Carlstrom Date: Thu, 5 Dec 2024 15:59:52 -0500 Subject: [PATCH] update helper --- tests/test_pytypes.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/test_pytypes.py b/tests/test_pytypes.py index 2a3ac3251..9db6a36fe 100644 --- a/tests/test_pytypes.py +++ b/tests/test_pytypes.py @@ -1104,13 +1104,7 @@ def test_dict_ranges(tested_dict, expected): def get_annotations_helper(o): - # Taken from __annotations__ docs - # https://docs.python.org/3/howto/annotations.html#accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older - if isinstance(o, type): - ann = o.__dict__.get("__annotations__", None) - else: - ann = getattr(o, "__annotations__", None) - return ann + return getattr(o, "__annotations__", None) def test_module_attribute_types() -> None: @@ -1124,7 +1118,7 @@ def test_class_attribute_types() -> None: empty_annotations = get_annotations_helper(m.EmptyAnnotationClass) annotations = get_annotations_helper(m.Point) - assert empty_annotations is None + assert empty_annotations == {} assert annotations["x"] == "float" assert annotations["dict_str_int"] == "dict[str, int]"