"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "analysis/test/integration/tupleTest.ml" between
pyre-check-0.0.54.tar.gz and pyre-check-0.0.55.tar.gz

About: Pyre is a performant type checker for Python (ships with Pysa, a security focused static analysis tool).

tupleTest.ml  (pyre-check-0.0.54):tupleTest.ml  (pyre-check-0.0.55)
skipping to change at line 461 skipping to change at line 461
{| {|
import typing import typing
def foo() -> typing.Tuple[int, int]: def foo() -> typing.Tuple[int, int]:
x = (0, 1, "two") x = (0, 1, "two")
return x[0:2] return x[0:2]
|} |}
[ [
"Incompatible return type [7]: Expected `typing.Tuple[int, int]` but got " "Incompatible return type [7]: Expected `typing.Tuple[int, int]` but got "
^ "`typing.Tuple[typing.Union[int, str], ...]`."; ^ "`typing.Tuple[typing.Union[int, str], ...]`.";
]; ];
assert_type_errors
{|
def func(a: int, b: str, c: bool) -> None:
pass
x = (42, "bla", False)
func( *x)
|}
[];
assert_type_errors
{|
def func(a: int, b: str, c: bool) -> None:
pass
c = ("bla", False)
func(1, *c)
|}
[];
assert_type_errors
{|
def func(a: int, b: str, c: bool) -> None:
pass
c = ("bla", )
func(1, *c)
|}
["Missing argument [20]: Call `func` expects argument `c`."];
assert_type_errors
{|
def func(a: int, b: bool, c: str) -> None:
pass
c = ("bla", False)
func(1, *c)
|}
[
"Incompatible parameter type [6]: Expected `bool` for 2nd positional only
parameter to call \
`func` but got `str`.";
];
assert_type_errors
{|
def func(a: int, b: bool, c: str, d:int, e:str) -> None:
pass
c = (False, "ble")
d = (1, "abc")
func(1, *c, *d)
|}
[];
() ()
let test_custom_tuple context = let test_custom_tuple context =
let assert_type_errors = assert_type_errors ~context in let assert_type_errors = assert_type_errors ~context in
assert_type_errors assert_type_errors
{| {|
class C: class C:
def __getitem__(self, index: int) -> int: def __getitem__(self, index: int) -> int:
self.counter += 1 self.counter += 1
return self.counter return self.counter
 End of changes. 1 change blocks. 
0 lines changed or deleted 45 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)