MCPcopy Index your code
hub / github.com/python/cpython / test_descriptors

Method test_descriptors

Lib/test/test_functools.py:753–764  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

751 self.assertNotHasAttr(self.a.static, "__self__")
752
753 def test_descriptors(self):
754 for obj in [self.A, self.a]:
755 with self.subTest(obj=obj):
756 self.assertEqual(obj.static(), ((8,), {}))
757 self.assertEqual(obj.static(5), ((8, 5), {}))
758 self.assertEqual(obj.static(d=8), ((8,), {'d': 8}))
759 self.assertEqual(obj.static(5, d=8), ((8, 5), {'d': 8}))
760
761 self.assertEqual(obj.cls(), ((self.A,), {'d': 9}))
762 self.assertEqual(obj.cls(5), ((self.A, 5), {'d': 9}))
763 self.assertEqual(obj.cls(c=8), ((self.A,), {'c': 8, 'd': 9}))
764 self.assertEqual(obj.cls(5, c=8), ((self.A, 5), {'c': 8, 'd': 9}))
765
766 def test_overriding_keywords(self):
767 self.assertEqual(self.a.keywords(a=3), ((self.a,), {'a': 3}))

Callers

nothing calls this directly

Calls 3

subTestMethod · 0.45
assertEqualMethod · 0.45
clsMethod · 0.45

Tested by

no test coverage detected