summaryrefslogtreecommitdiff
path: root/pylint/test
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-05-20 09:36:51 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2019-05-20 09:36:51 +0200
commit07d5e37b9d2bded9eb98e47dacd1feff6af0188a (patch)
tree7eb5bd616a30cc200bef807658956126231c027a /pylint/test
parent50a670b1eee2a28c771daceeb169a0db4805ddae (diff)
downloadpylint-git-07d5e37b9d2bded9eb98e47dacd1feff6af0188a.tar.gz
Support fully qualified typing imports for type annotations.
Close #2915
Diffstat (limited to 'pylint/test')
-rw-r--r--pylint/test/functional/unused_typing_imports.py19
-rw-r--r--pylint/test/functional/unused_typing_imports.rc1
2 files changed, 18 insertions, 2 deletions
diff --git a/pylint/test/functional/unused_typing_imports.py b/pylint/test/functional/unused_typing_imports.py
index e2fd4ae8a..6edca7153 100644
--- a/pylint/test/functional/unused_typing_imports.py
+++ b/pylint/test/functional/unused_typing_imports.py
@@ -6,7 +6,18 @@ which means we were never processing them.
"""
import re
-from typing import Optional, Callable, Iterable, Any, List, Tuple, Set, NamedTuple, Pattern
+import typing
+from typing import (
+ Any,
+ Callable,
+ Iterable,
+ List,
+ NamedTuple,
+ Optional,
+ Pattern,
+ Set,
+ Tuple,
+)
def func1(arg: Optional[Callable]=None):
@@ -37,3 +48,9 @@ with ContextManager() as SOME_DICT: # type: Set[int]
def func_test_type_comment(param):
# type: (NamedTuple) -> Tuple[NamedTuple, Pattern]
return param, re.compile('good')
+
+
+def typing_fully_qualified():
+ variable = None # type: typing.Optional[str]
+ other_variable: 'typing.Optional[str]' = None
+ return variable, other_variable
diff --git a/pylint/test/functional/unused_typing_imports.rc b/pylint/test/functional/unused_typing_imports.rc
index dca49456e..0ba2b6333 100644
--- a/pylint/test/functional/unused_typing_imports.rc
+++ b/pylint/test/functional/unused_typing_imports.rc
@@ -1,3 +1,2 @@
[testoptions]
min_pyver=3.6
-max_pyver=3.7 \ No newline at end of file