-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Showing
7 changed files
with
54 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from types import UnionType | ||
|
||
def is_type(x) -> bool: | ||
return isinstance(x, type) or \ | ||
isinstance(x, UnionType) |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
assert 1 in (Int or Str) | ||
assert 1.2 notin (Int or Str) | ||
|
||
dic = {:} | ||
assert dic in {:} | ||
assert dic in {Str: Int} | ||
assert dic in {Str: Str} | ||
dic2 = {"a": 1} | ||
assert dic2 in {Str or Int: Int} | ||
assert dic2 in {Str: Int or Str} | ||
assert dic2 notin {Int: Int} | ||
|
||
tup = () | ||
assert tup in () | ||
assert tup in (Int, Int) | ||
assert tup in (Int, Str) | ||
|
||
arr = [] | ||
assert arr in [] | ||
assert arr in [Int] | ||
assert arr in [Str] |
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