mirror of
https://github.com/microsoft/pyright.git
synced 2024-09-11 16:06:39 +03:00
Added test case for message form of assert.
This commit is contained in:
parent
7269265c5b
commit
4614ea341c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user