Example #1
0
 def f(i):
     d = r_dict(strange_key_eq, strange_key_hash)
     h = strange_key_hash("abc")
     assert h == strange_key_hash("aXX") and strange_key_eq("abc", "aXX")
     setitem_with_hash(d, "abc", h, i)
     assert getitem_with_hash(d, "aXX", h) == i
     try:
         getitem_with_hash(d, "bYY", strange_key_hash("bYY"))
     except KeyError:
         pass
     else:
         raise AssertionError
     return 0
Example #2
0
 def f(i):
     d = r_dict(strange_key_eq, strange_key_hash)
     h = strange_key_hash("abc")
     assert h == strange_key_hash("aXX") and strange_key_eq("abc", "aXX")
     setitem_with_hash(d, "abc", h, i)
     assert getitem_with_hash(d, "aXX", h) == i
     try:
         getitem_with_hash(d, "bYY", strange_key_hash("bYY"))
     except KeyError:
         pass
     else:
         raise AssertionError
     return 0
Example #3
0
 def f(i):
     d = {}
     setitem_with_hash(d, i + .5, compute_hash(i + .5), 42)
     setitem_with_hash(d, i + .6, compute_hash(i + .6), -612)
     return d[i + .5]
Example #4
0
 def f(i):
     d = {}
     setitem_with_hash(d, i + .5, compute_hash(i + .5), 42)
     setitem_with_hash(d, i + .6, compute_hash(i + .6), -612)
     return d[i + .5]