Created
September 23, 2015 16:10
-
-
Save chintanop/9ce762314538b1e6ee67 to your computer and use it in GitHub Desktop.
Test MyPy
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
class Test1: | |
def create(self, a:int, b:str) -> None: | |
print("hello") | |
class Test2: | |
def create(self): | |
""" No error or warning generated even if first argument is a string here""" | |
a = "abc" # should've complained here! | |
b = "def" | |
Test1().create(a, b) | |
if __name__ == "__main__": | |
a = 5 # works correcty | |
""" If a is changed to "abc", it complains CORRECTLY: | |
Argument 1 to "create" of "Test1" has incompatible type "str"; expected "int" | |
""" | |
b = "def" | |
Test1().create(a,b) | |
Test2().create() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment