diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-21 19:41:57 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-21 19:41:57 (GMT) |
commit | bf341fb5f6016ca5c79cee01211631ab5a01c5cf (patch) | |
tree | f1f93f45f17bc2404d044996fc55fb654de09367 /Lib/test | |
parent | 0978b5cdb36ef73061e438c342b508dd38c73ce8 (diff) | |
download | cpython-bf341fb5f6016ca5c79cee01211631ab5a01c5cf.zip cpython-bf341fb5f6016ca5c79cee01211631ab5a01c5cf.tar.gz cpython-bf341fb5f6016ca5c79cee01211631ab5a01c5cf.tar.bz2 |
Issue 23898: Fix inspect.classify_class_attrs() to work with __eq__
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_inspect.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index a2bb9b6..8d92f82 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -782,6 +782,21 @@ class TestClassesAndFunctions(unittest.TestCase): should_find_ga = inspect.Attribute('ham', 'data', Meta, 'spam') self.assertIn(should_find_ga, inspect.classify_class_attrs(VA)) + def test_classify_overrides_bool(self): + class NoBool(object): + def __eq__(self, other): + return NoBool() + + def __bool__(self): + raise NotImplementedError( + "This object does not specify a boolean value") + + class HasNB(object): + dd = NoBool() + + should_find_attr = inspect.Attribute('dd', 'data', HasNB, HasNB.dd) + self.assertIn(should_find_attr, inspect.classify_class_attrs(HasNB)) + def test_classify_metaclass_class_attribute(self): class Meta(type): fish = 'slap' |