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

Method test_subclass_with_custom_hash

Lib/test/test_set.py:302–313  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

300 elem.set = set([elem])
301
302 def test_subclass_with_custom_hash(self):
303 # Bug #1257731
304 class H(self.thetype):
305 def __hash__(self):
306 return int(id(self) & 0x7fffffff)
307 s=H()
308 f=set()
309 f.add(s)
310 self.assertIn(s, f)
311 f.remove(s)
312 f.add(s)
313 f.discard(s)
314
315 def test_badcmp(self):
316 s = self.thetype([BadCmp()])

Callers

nothing calls this directly

Calls 6

setFunction · 0.85
assertInMethod · 0.80
HClass · 0.70
addMethod · 0.45
removeMethod · 0.45
discardMethod · 0.45

Tested by

no test coverage detected