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

Method test_hash

Lib/test/test_slice.py:82–92  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

80 self.assertEqual(repr(slice(1, 2, 3)), "slice(1, 2, 3)")
81
82 def test_hash(self):
83 self.assertEqual(hash(slice(5)), slice(5).__hash__())
84 self.assertEqual(hash(slice(1, 2)), slice(1, 2).__hash__())
85 self.assertEqual(hash(slice(1, 2, 3)), slice(1, 2, 3).__hash__())
86 self.assertNotEqual(slice(5), slice(6))
87
88 with self.assertRaises(TypeError):
89 hash(slice(1, 2, []))
90
91 with self.assertRaises(TypeError):
92 hash(slice(4, {}))
93
94 def test_cmp(self):
95 s1 = slice(1, 2, 3)

Callers

nothing calls this directly

Calls 5

sliceClass · 0.85
assertNotEqualMethod · 0.80
assertEqualMethod · 0.45
__hash__Method · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected