1- from inspect import signature
2-
1+ from ..compat import PY3 , signature
32from ..typecheck import compatible
43
54
@@ -18,48 +17,6 @@ def bar(): # pragma: nocover
1817 assert compatible (bar , bar )
1918
2019
21- def test_allow_new_params_with_defaults ():
22-
23- @signature
24- def iface (a , b , c ): # pragma: nocover
25- pass
26-
27- @signature
28- def impl (a , b , c , d = 3 , e = 5 , * , f = 5 ): # pragma: nocover
29- pass
30-
31- assert compatible (impl , iface )
32- assert not compatible (iface , impl )
33-
34-
35- def test_allow_reorder_kwonlys ():
36-
37- @signature
38- def foo (a , b , c , * , d , e , f ): # pragma: nocover
39- pass
40-
41- @signature
42- def bar (a , b , c , * , f , d , e ): # pragma: nocover
43- pass
44-
45- assert compatible (foo , bar )
46- assert compatible (bar , foo )
47-
48-
49- def test_allow_default_changes ():
50-
51- @signature
52- def foo (a , b , c = 3 , * , d = 1 , e , f ): # pragma: nocover
53- pass
54-
55- @signature
56- def bar (a , b , c = 5 , * , f , e , d = 12 ): # pragma: nocover
57- pass
58-
59- assert compatible (foo , bar )
60- assert compatible (bar , foo )
61-
62-
6320def test_disallow_new_or_missing_positionals ():
6421
6522 @signature
@@ -101,15 +58,19 @@ def bar(b, a): # pragma: nocover
10158 assert not compatible (bar , foo )
10259
10360
104- def test_disallow_kwonly_to_positional ():
61+ def test_allow_new_params_with_defaults_no_kwonly ():
10562
10663 @signature
107- def foo (a , * , b ): # pragma: nocover
64+ def iface (a , b , c ): # pragma: nocover
10865 pass
10966
11067 @signature
111- def bar (a , b ): # pragma: nocover
68+ def impl (a , b , c , d = 3 , e = 5 , f = 5 ): # pragma: nocover
11269 pass
11370
114- assert not compatible (foo , bar )
115- assert not compatible (bar , foo )
71+ assert compatible (impl , iface )
72+ assert not compatible (iface , impl )
73+
74+
75+ if PY3 : # pragma: nocover
76+ from ._py3_typecheck_tests import *
0 commit comments