Skip to content

Commit

Permalink
More test fixing.
Browse files Browse the repository at this point in the history
  • Loading branch information
anntzer committed Apr 10, 2022
1 parent df3ff31 commit db7c04a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion test_typing_inspect.py
Expand Up @@ -306,7 +306,8 @@ def test_origin(self):
self.assertEqual(get_origin(ClassVar[int]), None)
self.assertEqual(get_origin(Generic), Generic)
self.assertEqual(get_origin(Generic[T]), Generic)
self.assertEqual(get_origin(Literal[42]), Literal)
# Cannot use assertEqual on Py3.5.2.
self.assertIs(get_origin(Literal[42]), Literal)
if PY39:
self.assertEqual(get_origin(list[int]), list)
if GENERIC_TUPLE_PARAMETRIZABLE:
Expand Down
6 changes: 3 additions & 3 deletions typing_inspect.py
Expand Up @@ -63,10 +63,10 @@
WITH_FINAL = False

try: # python 3.6
from typing_extensions import Literal, _Literal
from typing_extensions import Literal
except ImportError: # python 2.7
try:
from typing import _Literal
from typing import Literal
except ImportError:
WITH_LITERAL = False

Expand Down Expand Up @@ -212,7 +212,7 @@ def is_literal_type(tp):
if NEW_TYPING:
return (tp is Literal or
isinstance(tp, typingGenericAlias) and tp.__origin__ is Literal)
return WITH_LITERAL and type(tp) is _Literal
return WITH_LITERAL and type(tp) is type(Literal)


def is_typevar(tp):
Expand Down

0 comments on commit db7c04a

Please sign in to comment.