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

Method test_set_name_modifying_dict

Lib/test/test_subclassinit.py:198–212  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

196 self.assertEqual(B.name, 'd')
197
198 def test_set_name_modifying_dict(self):
199 notified = []
200 class Descriptor:
201 def __set_name__(self, owner, name):
202 setattr(owner, name + 'x', None)
203 notified.append(name)
204
205 class A:
206 a = Descriptor()
207 b = Descriptor()
208 c = Descriptor()
209 d = Descriptor()
210 e = Descriptor()
211
212 self.assertCountEqual(notified, ['a', 'b', 'c', 'd', 'e'])
213
214 def test_errors(self):
215 class MyMeta(type):

Callers

nothing calls this directly

Calls 1

assertCountEqualMethod · 0.80

Tested by

no test coverage detected