summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorFELD Boris <lothiraldan@gmail.com>2012-09-19 14:39:05 +0200
committerFELD Boris <lothiraldan@gmail.com>2012-09-19 14:39:05 +0200
commit10e92212351ce62e213c068b99833cd573df7ce1 (patch)
treed0691f95160ba4a6d9aaa634e02e17d628ef95ce /test
parent44db90cd6c79d9b25d55f30b5576a05d2c4d79f2 (diff)
downloadpylint-10e92212351ce62e213c068b99833cd573df7ce1.tar.gz
Add test and code for handling __all__ with pylint. Closes #4685.
Diffstat (limited to 'test')
-rw-r--r--test/input/func_all.py45
-rw-r--r--test/messages/func_all.txt4
2 files changed, 49 insertions, 0 deletions
diff --git a/test/input/func_all.py b/test/input/func_all.py
new file mode 100644
index 0000000..e9f1fc8
--- /dev/null
+++ b/test/input/func_all.py
@@ -0,0 +1,45 @@
+"""Test Pylint's use of __all__.
+
+* NonExistant is not defined in this module, and it is listed in
+ __all__. An error is expected.
+
+* This module imports path and republished it in __all__. No errors
+ are expected.
+"""
+# pylint: disable=R0903,R0201,W0612
+
+__revision__ = 0
+
+from os import path
+
+__all__ = [
+ 'Dummy',
+ 'NonExistant',
+ 'path',
+ 'func',
+ 'inner',
+ 'InnerKlass']
+
+
+class Dummy(object):
+ """A class defined in this module."""
+ pass
+
+DUMMY = Dummy()
+
+def function():
+ """Function docstring
+ """
+ pass
+
+function()
+
+class Klass(object):
+ """A klass which contains a function"""
+ def func(self):
+ """A klass method"""
+ inner = None
+
+ class InnerKlass(object):
+ """A inner klass"""
+ pass
diff --git a/test/messages/func_all.txt b/test/messages/func_all.txt
new file mode 100644
index 0000000..ba0e855
--- /dev/null
+++ b/test/messages/func_all.txt
@@ -0,0 +1,4 @@
+E: 17: Undefined variable name 'NonExistant' in __all__
+E: 19: Undefined variable name 'func' in __all__
+E: 20: Undefined variable name 'inner' in __all__
+E: 21: Undefined variable name 'InnerKlass' in __all__