summaryrefslogtreecommitdiff
path: root/pyflakes/test/test_type_annotations.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyflakes/test/test_type_annotations.py')
-rw-r--r--pyflakes/test/test_type_annotations.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index 48635bb..b8876cb 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -39,6 +39,41 @@ class TestTypeAnnotations(TestCase):
return s
""")
+ def test_overload_with_multiple_decorators(self):
+ self.flakes("""
+ from typing import overload
+ dec = lambda f: f
+
+ @dec
+ @overload
+ def f(x): # type: (int) -> int
+ pass
+
+ @dec
+ @overload
+ def f(x): # type: (str) -> str
+ pass
+
+ @dec
+ def f(x): return x
+ """)
+
+ def test_overload_in_class(self):
+ self.flakes("""
+ from typing import overload
+
+ class C:
+ @overload
+ def f(self, x): # type: (int) -> int
+ pass
+
+ @overload
+ def f(self, x): # type: (str) -> str
+ pass
+
+ def f(self, x): return x
+ """)
+
def test_not_a_typing_overload(self):
"""regression test for @typing.overload detection bug in 2.1.0"""
self.flakes("""