MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_record_hash

Method test_record_hash

tests/test_record.py:200–219  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

198 list(it)
199
200 def test_record_hash(self):
201 AB = collections.namedtuple('AB', ('a', 'b'))
202 r1 = Record(R_AB, (42, 43))
203 r2 = Record(R_AB, (42, 43))
204 r3 = Record(R_AB, (42, 45))
205 r4 = (42, 43)
206 r5 = AB(42, 43)
207
208 self.assertEqual(hash(r1), hash(r2))
209 self.assertNotEqual(hash(r1), hash(r3))
210 self.assertEqual(hash(r1), hash(r4))
211 self.assertEqual(hash(r1), hash(r5))
212
213 d = {}
214 d[r1] = 123
215 self.assertEqual(d[r1], 123)
216 self.assertIn(r2, d)
217 self.assertEqual(d[r2], 123)
218 self.assertNotIn(r3, d)
219 self.assertIn(r4, d)
220
221 def test_record_contains(self):
222 r = Record(R_AB, (42, 43))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected