mirror of https://github.com/mtshiba/pylyzer
test: add union type tests
This commit is contained in:
parent
94221a6419
commit
d448aaf974
|
|
@ -142,6 +142,11 @@ fn exec_typevar() -> Result<(), String> {
|
||||||
expect("tests/typevar.py", 0, 3)
|
expect("tests/typevar.py", 0, 3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn exec_union() -> Result<(), String> {
|
||||||
|
expect("tests/union.py", 0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn exec_widening() -> Result<(), String> {
|
fn exec_widening() -> Result<(), String> {
|
||||||
expect("tests/widening.py", 0, 1)
|
expect("tests/widening.py", 0, 1)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
s: str | bytes = ""
|
||||||
|
s2 = s.capitalize()
|
||||||
|
s3 = s2.center(1)
|
||||||
|
|
||||||
|
s4: str | bytes | bytearray = ""
|
||||||
|
_ = s4.__len__()
|
||||||
|
|
||||||
|
def f(x: str | bytes):
|
||||||
|
return x.isalnum()
|
||||||
Loading…
Reference in New Issue