mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 13:33:09 +00:00
Only consider classes defined in the module we're looking at.
Classes can lie about their __module__, of course, but I hope none of Tahoe's do.
This commit is contained in:
parent
b1c7556239
commit
132cc4605d
@ -15,6 +15,9 @@ def is_classic_class(obj):
|
|||||||
# not a class. So ... less than completely useful.
|
# not a class. So ... less than completely useful.
|
||||||
return type(obj) is ClassType
|
return type(obj) is ClassType
|
||||||
|
|
||||||
|
def defined_here(obj, where):
|
||||||
|
return obj.__module__ == where
|
||||||
|
|
||||||
class PythonTwoRegressions(unittest.TestCase):
|
class PythonTwoRegressions(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
A test class to hold Python2 regression tests.
|
A test class to hold Python2 regression tests.
|
||||||
@ -29,6 +32,6 @@ class PythonTwoRegressions(unittest.TestCase):
|
|||||||
for attr in mod.iterAttributes():
|
for attr in mod.iterAttributes():
|
||||||
value = attr.load()
|
value = attr.load()
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
is_classic_class(value),
|
is_classic_class(value) and defined_here(value, mod.name),
|
||||||
"{} appears to be a classic class".format(attr.name),
|
"{} appears to be a classic class".format(attr.name),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user