File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -330,15 +330,16 @@ def test_hash_distribution(self):
330330 base = "abcdefghabcdefg"
331331 for i in range (1 , len (base )):
332332 prefix = base [:i ]
333- s15 = set ()
334- s255 = set ()
335- for c in range (256 ):
336- h = hash (prefix + chr (c ))
337- s15 .add (h & 0xf )
338- s255 .add (h & 0xff )
339- # SipHash24 distribution depends on key, usually > 60%
340- self .assertGreater (len (s15 ), 8 , prefix )
341- self .assertGreater (len (s255 ), 128 , prefix )
333+ with self .subTest (prefix = prefix ):
334+ s15 = set ()
335+ s255 = set ()
336+ for c in range (256 ):
337+ h = hash (prefix + chr (c ))
338+ s15 .add (h & 0xf )
339+ s255 .add (h & 0xff )
340+ # SipHash24 distribution depends on key, usually > 60%
341+ self .assertGreater (len (s15 ), 8 , prefix )
342+ self .assertGreater (len (s255 ), 128 , prefix )
342343
343344if __name__ == "__main__" :
344345 unittest .main ()
You can’t perform that action at this time.
0 commit comments