Skip to content

Commit 5754822

Browse files
committed
Move test to test_builtin.
1 parent 1b96db7 commit 5754822

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Lib/test/test_builtin.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,16 @@ def __hash__(self):
11841184
return self
11851185
self.assertEqual(hash(Z(42)), hash(42))
11861186

1187+
def test_invalid_hash_typeerror(self):
1188+
# GH-140406: The returned object from __hash__() would leak if it
1189+
# wasn't an integer.
1190+
class A:
1191+
def __hash__(self):
1192+
return 1.0
1193+
1194+
with self.assertRaises(TypeError):
1195+
hash(A())
1196+
11871197
def test_hex(self):
11881198
self.assertEqual(hex(16), '0x10')
11891199
self.assertEqual(hex(-16), '-0x10')

Lib/test/test_hash.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,6 @@ def test_hashes(self):
166166
for obj in self.hashes_to_check:
167167
self.assertEqual(hash(obj), _default_hash(obj))
168168

169-
def test_invalid_hash_typeerror(self):
170-
# GH-140406: The returned object from __hash__() would leak if it
171-
# wasn't an integer.
172-
class A:
173-
def __hash__(self):
174-
return 1.0
175-
176-
with self.assertRaises(TypeError):
177-
hash(A())
178-
179169
class HashRandomizationTests:
180170

181171
# Each subclass should define a field "repr_", containing the repr() of

0 commit comments

Comments
 (0)