-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64611f6
commit 2dd29c9
Showing
5 changed files
with
69 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
from typing import Union | ||
|
||
import pytest | ||
|
||
if sys.version_info >= (3, 9): # prevent mypy errors | ||
def test_literal_type_positive(): | ||
from typing import Literal | ||
|
||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="need 3.9 for LiteralType") | ||
def test_literal_type_positive(): | ||
from typing import Literal | ||
from basedtyping.runtime_only import LiteralType | ||
|
||
from basedtyping.runtime_only import LiteralType | ||
assert isinstance(Literal[1, 2], LiteralType) | ||
|
||
assert isinstance(Literal[1, 2], LiteralType) | ||
|
||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="need 3.9 for LiteralType") | ||
def test_literal_type_negative(): | ||
from basedtyping.runtime_only import LiteralType | ||
def test_literal_type_negative(): | ||
from basedtyping.runtime_only import LiteralType | ||
|
||
assert not isinstance(Union[int, str], LiteralType) | ||
assert not isinstance(Union[int, str], LiteralType) |