Skip to content

Commit 1cdd431

Browse files
author
Rami Chowdhury
committed
Limit typing.Literal singleton test
1 parent 59837ef commit 1cdd431

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/test_converters.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ def test_literal():
8787
assert field.default_value == 3
8888
assert field.type.of_type.__name__.startswith("UnionOf")
8989

90+
91+
if sys.version_info >= (3, 10):
92+
# Python < 3.10 does not support typing.Literal except as a
93+
# _SpecialGenericAlias, which Pydantic doesn't like
94+
9095
def test_literal_singleton():
9196
field = _convert_field_from_spec("attr", (T.Literal["literal1"], "literal1"))
9297
assert issubclass(field.type.of_type, graphene.String)

0 commit comments

Comments
 (0)