コード例 #1
0
ファイル: test_objectmodel.py プロジェクト: mozillazg/pypy
 def f(i):
     d = {i + .0: 5, i + .5: 6}
     total = 0
     for k, h in iterkeys_with_hash(d):
         total += k * h
     total -= (i + 0.0) * compute_hash(i + 0.0)
     total -= (i + 0.5) * compute_hash(i + 0.5)
     return total
コード例 #2
0
 def f(i):
     d = {i + .0: 5, i + .5: 6}
     total = 0
     for k, h in iterkeys_with_hash(d):
         total += k * h
     total -= (i + 0.0) * compute_hash(i + 0.0)
     total -= (i + 0.5) * compute_hash(i + 0.5)
     return total
コード例 #3
0
ファイル: test_typed.py プロジェクト: soIu/rpython
 def fn(n):
     from rpython.rlib import rsiphash
     rsiphash.enable_siphash24()
     #assert str(n) not in prebuilt_d <- this made the test pass,
     #       before the fix which was that iterkeys_with_hash()
     #       didn't do the initial rehashing on its own
     for key, h in objectmodel.iterkeys_with_hash(prebuilt_d):
         print key, h
         assert h == compute_hash(key)
     return 42