summaryrefslogtreecommitdiff
path: root/pylint/test/unittest_checker_python3.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2018-04-12 15:41:55 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2018-04-12 15:46:49 +0200
commitb045f17b9249061e43ff18396c5eaa7896d36c54 (patch)
tree8ce1b08f152e5c51f97a803feff5294f8f6da8d0 /pylint/test/unittest_checker_python3.py
parent9c7ea46b0c411659383d4948a54481fbddfb8df0 (diff)
downloadpylint-git-b045f17b9249061e43ff18396c5eaa7896d36c54.tar.gz
Added a new Python 2/3 check for accessing removed urllib functions
Close #1997
Diffstat (limited to 'pylint/test/unittest_checker_python3.py')
-rw-r--r--pylint/test/unittest_checker_python3.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/pylint/test/unittest_checker_python3.py b/pylint/test/unittest_checker_python3.py
index 375129815..b84fa86ef 100644
--- a/pylint/test/unittest_checker_python3.py
+++ b/pylint/test/unittest_checker_python3.py
@@ -697,6 +697,21 @@ class TestPython3Checker(testutils.CheckerTestCase):
self.checker.visit_attribute(node)
@python2_only
+ def test_bad_urllib_attribute(self):
+ nodes = astroid.extract_node('''
+ import urllib
+ urllib.addbase #@
+ urllib.splithost #@
+ urllib.urlretrieve #@
+ urllib.urlopen #@
+ urllib.urlencode #@
+ ''')
+ for node in nodes:
+ message = testutils.Message('deprecated-urllib-function', node=node)
+ with self.assertAddsMessages(message):
+ self.checker.visit_attribute(node)
+
+ @python2_only
def test_ok_string_attribute(self):
node = astroid.extract_node('''
import string