Commit 6f5a9c52 authored by Tom Niget's avatar Tom Niget

Add class method optional parameter tests

parent 4febcf3d
......@@ -15,7 +15,8 @@ U = TypeVar("U")
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:
def __len__(self) -> int: ...
......@@ -109,4 +110,15 @@ assert __test_opt
assert __test_opt(5)
assert __test_opt(5, 6)
assert not __test_opt(5, 6, 7)
assert not __test_opt()
\ No newline at end of file
assert not __test_opt()
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