Commit 43ab4820 authored by Tom Niget's avatar Tom Niget

Add class method optional parameter tests

parent bd64b1c6
...@@ -15,7 +15,8 @@ U = TypeVar("U") ...@@ -15,7 +15,8 @@ U = TypeVar("U")
V = TypeVar("V") V = TypeVar("V")
# TODO: really, these should work as interfaces, on a duck-typing basis. it's gonna be a hell of a ride to implement
# unification for this
class HasLen: class HasLen:
def __len__(self) -> int: ... def __len__(self) -> int: ...
...@@ -109,4 +110,15 @@ assert __test_opt ...@@ -109,4 +110,15 @@ assert __test_opt
assert __test_opt(5) assert __test_opt(5)
assert __test_opt(5, 6) assert __test_opt(5, 6)
assert not __test_opt(5, 6, 7) assert not __test_opt(5, 6, 7)
assert not __test_opt() assert not __test_opt()
\ No newline at end of file
class __test_type:
def __init__(self) -> None: ...
def test_opt(self, x: int, y: int = 5) -> int:
...
assert __test_type().test_opt(5)
assert __test_type().test_opt(5, 6)
assert not __test_type().test_opt(5, 6, 7)
assert not __test_type().test_opt()
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment