Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuDartiailh committed Jan 7, 2025
1 parent 489cbc2 commit 6c25b7d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions atom/meta/annotation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def generate_member_from_type_or_generic(
) -> Member:
"""Generate a member from a type or generic alias."""
# Here we special case Literal to generate an Enum member.
types: tuple[type, ...]
if get_origin(type_generic) is Literal:
types = ()
else:
Expand Down
1 change: 0 additions & 1 deletion tests/test_atom_from_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ class A(Atom, use_annotations=True, type_containers=depth):
(dict, Dict, {1: 2}),
(defaultdict, DefaultDict, defaultdict(int, {1: 2})),
(Literal[1, 2, "a"], Enum, 2),
],
)
def test_annotations_with_default(annotation, member, default):
Expand Down
1 change: 1 addition & 0 deletions tests/test_typing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def test_reject_str_annotations():
with pytest.raises(TypeError):
extract_types("int")


def test_reject_literal():
with pytest.raises(TypeError):
extract_types(Literal[1])

0 comments on commit 6c25b7d

Please sign in to comment.