def test_chexor(self): ts = (normalize_timestamp(ts) for ts in itertools.count(int(time.time()))) objects = [ ('frank', ts.next()), ('bob', ts.next()), ('tom', ts.next()), ('frank', ts.next()), ('tom', ts.next()), ('bob', ts.next()), ] hash_ = '0' random.shuffle(objects) for obj in objects: hash_ = chexor(hash_, *obj) other_hash = '0' random.shuffle(objects) for obj in objects: other_hash = chexor(other_hash, *obj) self.assertEqual(hash_, other_hash)
def test_normal_case(self): self.assertEquals( chexor('d41d8cd98f00b204e9800998ecf8427e', 'new name', normalize_timestamp(1)), '4f2ea31ac14d4273fe32ba08062b21de')