Added test case for message form of assert.

This commit is contained in:
Eric Traut 2019-05-28 18:27:42 -07:00
parent 7269265c5b
commit 4614ea341c

View File

@ -2,9 +2,11 @@
from typing import Union
condition = True
def foo(a: Union[str, int]) -> int:
if True:
if condition:
# This should generate an error because
# a could be a str.
return a
@ -12,3 +14,9 @@ def foo(a: Union[str, int]) -> int:
assert isinstance(a, int)
return a
def foo(a: Union[str, int]) -> int:
# Test the form of "assert" that includes a message string.
assert isinstance(a, int), "Message"
return a