diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-12 12:47:25 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-12-12 12:47:25 (GMT) |
commit | 9d57481f043cb9b94bfc45c1ee041415d915cf8a (patch) | |
tree | 4806f5aa23aa5f72bf9cafe2e1b438d69ccb1f51 /Lib/test/test_descr.py | |
parent | 16e6a80923db90031a50790613ef3673b30886d2 (diff) | |
download | cpython-9d57481f043cb9b94bfc45c1ee041415d915cf8a.zip cpython-9d57481f043cb9b94bfc45c1ee041415d915cf8a.tar.gz cpython-9d57481f043cb9b94bfc45c1ee041415d915cf8a.tar.bz2 |
Issue #13577: various kinds of descriptors now have a __qualname__ attribute.
Patch by sbt.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 4a7a9d2..2b2026c 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4442,6 +4442,24 @@ order (MRO) for bases """ self.assertIn("can't delete X.__doc__", str(cm.exception)) self.assertEqual(X.__doc__, "banana") + def test_qualname(self): + descriptors = [str.lower, complex.real, float.real, int.__add__] + types = ['method', 'member', 'getset', 'wrapper'] + + # make sure we have an example of each type of descriptor + for d, n in zip(descriptors, types): + self.assertEqual(type(d).__name__, n + '_descriptor') + + for d in descriptors: + qualname = d.__objclass__.__qualname__ + '.' + d.__name__ + self.assertEqual(d.__qualname__, qualname) + + self.assertEqual(str.lower.__qualname__, 'str.lower') + self.assertEqual(complex.real.__qualname__, 'complex.real') + self.assertEqual(float.real.__qualname__, 'float.real') + self.assertEqual(int.__add__.__qualname__, 'int.__add__') + + class DictProxyTests(unittest.TestCase): def setUp(self): class C(object): |