MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_descriptors

Method test_descriptors

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

Source from the content-addressed store, hash-verified

687 self.assertNotHasAttr(self.a.static, "__self__")
688
689 def test_descriptors(self):
690 for obj in [self.A, self.a]:
691 with self.subTest(obj=obj):
692 self.assertEqual(obj.static(), ((8,), {}))
693 self.assertEqual(obj.static(5), ((8, 5), {}))
694 self.assertEqual(obj.static(d=8), ((8,), {'d': 8}))
695 self.assertEqual(obj.static(5, d=8), ((8, 5), {'d': 8}))
696
697 self.assertEqual(obj.cls(), ((self.A,), {'d': 9}))
698 self.assertEqual(obj.cls(5), ((self.A, 5), {'d': 9}))
699 self.assertEqual(obj.cls(c=8), ((self.A,), {'c': 8, 'd': 9}))
700 self.assertEqual(obj.cls(5, c=8), ((self.A, 5), {'c': 8, 'd': 9}))
701
702 def test_overriding_keywords(self):
703 self.assertEqual(self.a.keywords(a=3), ((self.a,), {'a': 3}))

Callers

nothing calls this directly

Calls 3

subTestMethod · 0.80
assertEqualMethod · 0.45
clsMethod · 0.45

Tested by

no test coverage detected