diff options
author | root <none@none> | 2006-04-26 10:48:09 +0000 |
---|---|---|
committer | root <none@none> | 2006-04-26 10:48:09 +0000 |
commit | 4becf6f9e596b45401680c4947e2d92c953d5e08 (patch) | |
tree | 3bb03a16daa8c780bf60c622dc288eb01cfca145 /test/regrtest_data | |
download | pylint-git-4becf6f9e596b45401680c4947e2d92c953d5e08.tar.gz |
forget the past.
forget the past.
Diffstat (limited to 'test/regrtest_data')
-rw-r--r-- | test/regrtest_data/application_crash.py | 12 | ||||
-rw-r--r-- | test/regrtest_data/classdoc_usage.py | 17 | ||||
-rw-r--r-- | test/regrtest_data/descriptor_crash.py | 20 | ||||
-rw-r--r-- | test/regrtest_data/import_package_subpackage_module.py | 49 | ||||
-rw-r--r-- | test/regrtest_data/module_global.py | 7 | ||||
-rw-r--r-- | test/regrtest_data/numarray_import.py | 7 | ||||
-rw-r--r-- | test/regrtest_data/package/AudioTime.py | 3 | ||||
-rw-r--r-- | test/regrtest_data/package/__init__.py | 14 | ||||
-rw-r--r-- | test/regrtest_data/package/subpackage/__init__.py | 1 | ||||
-rw-r--r-- | test/regrtest_data/package/subpackage/module.py | 1 | ||||
-rw-r--r-- | test/regrtest_data/precedence_test.py | 21 | ||||
-rw-r--r-- | test/regrtest_data/pygtk_import.py | 14 | ||||
-rw-r--r-- | test/regrtest_data/socketerror_import.py | 6 |
13 files changed, 172 insertions, 0 deletions
diff --git a/test/regrtest_data/application_crash.py b/test/regrtest_data/application_crash.py new file mode 100644 index 000000000..6e6044aab --- /dev/null +++ b/test/regrtest_data/application_crash.py @@ -0,0 +1,12 @@ +class ErudiPublisher: + def __init__(self, config): + self.url_resolver = self.select_component('urlpublisher') + + def select_component(self, cid, *args, **kwargs): + try: + return self.select(self.registry_objects('components', cid), *args, **kwargs) + except NoSelectableObject: + return + + def main_publish(self, path, req): + ctrlid = self.url_resolver.process(req, path) diff --git a/test/regrtest_data/classdoc_usage.py b/test/regrtest_data/classdoc_usage.py new file mode 100644 index 000000000..ae8b9fe3f --- /dev/null +++ b/test/regrtest_data/classdoc_usage.py @@ -0,0 +1,17 @@ +"""ds""" + +__revision__ = None + +class SomeClass: + """cds""" + doc = __doc__ + + def __init__(self): + """only to make pylint happier""" + + def please(self): + """public method 1/2""" + + def besilent(self): + """public method 2/2""" + diff --git a/test/regrtest_data/descriptor_crash.py b/test/regrtest_data/descriptor_crash.py new file mode 100644 index 000000000..4b3adccde --- /dev/null +++ b/test/regrtest_data/descriptor_crash.py @@ -0,0 +1,20 @@ +# -*- coding: iso-8859-1 -*- + +import urllib + +class Page(object): + _urlOpen = staticmethod(urllib.urlopen) + + def getPage(self, url): + handle = self._urlOpen(url) + data = handle.read() + handle.close() + return data + #_getPage + +#Page + +if __name__ == "__main__": + import sys + p = Page() + print p.getPage(sys.argv[1]) diff --git a/test/regrtest_data/import_package_subpackage_module.py b/test/regrtest_data/import_package_subpackage_module.py new file mode 100644 index 000000000..b5fb219d1 --- /dev/null +++ b/test/regrtest_data/import_package_subpackage_module.py @@ -0,0 +1,49 @@ +# pylint: disable-msg=I0011,C0301,W0611 +"""I found some of my scripts trigger off an AttributeError in pylint +0.8.1 (with common 0.12.0 and astng 0.13.1). + +Traceback (most recent call last): + File "/usr/bin/pylint", line 4, in ? + lint.Run(sys.argv[1:]) + File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 729, in __init__ + linter.check(args) + File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 412, in check + self.check_file(filepath, modname, checkers) + File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 426, in check_file + astng = self._check_file(filepath, modname, checkers) + File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 450, in _check_file + self.check_astng_module(astng, checkers) + File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 494, in check_astng_module + self.astng_events(astng, [checker for checker in checkers + File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 511, in astng_events + self.astng_events(child, checkers, _reversed_checkers) + File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 511, in astng_events + self.astng_events(child, checkers, _reversed_checkers) + File "/usr/lib/python2.4/site-packages/pylint/lint.py", line 508, in astng_events + checker.visit(astng) + File "/usr/lib/python2.4/site-packages/logilab/astng/utils.py", line 84, in visit + method(node) + File "/usr/lib/python2.4/site-packages/pylint/checkers/variables.py", line 295, in visit_import + self._check_module_attrs(node, module, name_parts[1:]) + File "/usr/lib/python2.4/site-packages/pylint/checkers/variables.py", line 357, in _check_module_attrs + self.add_message('E0611', args=(name, module.name), +AttributeError: Import instance has no attribute 'name' + + +You can reproduce it by: +(1) create package structure like the following: + +package/ + __init__.py + subpackage/ + __init__.py + module.py + +(2) in package/__init__.py write: + +import subpackage + +(3) run pylint with a script importing package.subpackage.module. +""" +__revision__ = '$Id: import_package_subpackage_module.py,v 1.1 2005-11-10 16:08:54 syt Exp $' +import package.subpackage.module diff --git a/test/regrtest_data/module_global.py b/test/regrtest_data/module_global.py new file mode 100644 index 000000000..54fd46d33 --- /dev/null +++ b/test/regrtest_data/module_global.py @@ -0,0 +1,7 @@ +# pylint: disable-msg=W0603,W0601,W0604,E0602,W0104 +"""was causing infinite recursion +""" +__revision__ = 1 + +global bar +bar.foo diff --git a/test/regrtest_data/numarray_import.py b/test/regrtest_data/numarray_import.py new file mode 100644 index 000000000..3f0be8b7b --- /dev/null +++ b/test/regrtest_data/numarray_import.py @@ -0,0 +1,7 @@ +"""#10077""" + +__revision__ = 1 + +from numarray import zeros + +zeros() diff --git a/test/regrtest_data/package/AudioTime.py b/test/regrtest_data/package/AudioTime.py new file mode 100644 index 000000000..a1fde9650 --- /dev/null +++ b/test/regrtest_data/package/AudioTime.py @@ -0,0 +1,3 @@ +"""test preceeded by the AudioTime class in __init__.py""" + +__revision__ = 0 diff --git a/test/regrtest_data/package/__init__.py b/test/regrtest_data/package/__init__.py new file mode 100644 index 000000000..9e1ebfa68 --- /dev/null +++ b/test/regrtest_data/package/__init__.py @@ -0,0 +1,14 @@ +# pylint: disable-msg=R0903,W0403 +"""package's __init__ file""" + +__revision__ = 0 + +# E0602 - Undefined variable '__path__' +__path__ += "folder" + +class AudioTime(object): + """test precedence over the AudioTime submodule""" + + DECIMAL = 3 + +import subpackage diff --git a/test/regrtest_data/package/subpackage/__init__.py b/test/regrtest_data/package/subpackage/__init__.py new file mode 100644 index 000000000..dc4782e6c --- /dev/null +++ b/test/regrtest_data/package/subpackage/__init__.py @@ -0,0 +1 @@ +"""package.subpackage""" diff --git a/test/regrtest_data/package/subpackage/module.py b/test/regrtest_data/package/subpackage/module.py new file mode 100644 index 000000000..4b7244ba0 --- /dev/null +++ b/test/regrtest_data/package/subpackage/module.py @@ -0,0 +1 @@ +"""package.subpackage.module""" diff --git a/test/regrtest_data/precedence_test.py b/test/regrtest_data/precedence_test.py new file mode 100644 index 000000000..087b5cf4d --- /dev/null +++ b/test/regrtest_data/precedence_test.py @@ -0,0 +1,21 @@ +""" + # package/__init__.py + class AudioTime(object): + DECIMAL = 3 + + # package/AudioTime.py + class AudioTime(object): + pass + + # test.py + from package import AudioTime + # E0611 - No name 'DECIMAL' in module 'AudioTime.AudioTime' + print AudioTime.DECIMAL + +""" + +__revision__ = 0 + +from package import AudioTime + +print AudioTime.DECIMAL diff --git a/test/regrtest_data/pygtk_import.py b/test/regrtest_data/pygtk_import.py new file mode 100644 index 000000000..4ac95606f --- /dev/null +++ b/test/regrtest_data/pygtk_import.py @@ -0,0 +1,14 @@ +#pylint: disable-msg=R0903,R0904 +"""#10026""" +__revision__ = 1 +from gtk import VBox +import gtk + +class FooButton(gtk.Button): + """extend gtk.Button""" + def extend(self): + """hop""" + print self + +print gtk.Button +print VBox diff --git a/test/regrtest_data/socketerror_import.py b/test/regrtest_data/socketerror_import.py new file mode 100644 index 000000000..37310cfa6 --- /dev/null +++ b/test/regrtest_data/socketerror_import.py @@ -0,0 +1,6 @@ +"""ds""" + +__revision__ = '$Id: socketerror_import.py,v 1.2 2005-12-28 14:58:22 syt Exp $' + +from socket import error +print error |