+ def test_pieces_other_hashes(self):
+ """Tests updating of pieces a little at a time."""
+ h = HashObject()
+ for hashType in h.ORDER:
+ if hashType['name'] != 'sha1':
+ h.hashTypeNum = h.ORDER.index(hashType)
+ break
+ assert h.ORDER[h.hashTypeNum]['name'] != 'sha1'
+ h.new(True)
+ for i in xrange(120*1024):
+ h.update('1234567890')
+ pieces = h.pieceDigests()
+ self.failUnless(len(pieces) == 3)
+ self.failUnless(pieces[0] == ',G \xd8\xbbPl\xf1\xa3\xa0\x0cW\n\xe6\xe6a\xc9\x95/\xe5')
+ self.failUnless(pieces[1] == '\xf6V\xeb/\xa8\xad[\x07Z\xf9\x87\xa4\xf5w\xdf\xe1|\x00\x8e\x93')
+ self.failUnless(pieces[2] == 'M[\xbf\xee\xaa+\x19\xbaV\xf699\r\x17o\xcb\x8e\xcfP\x19')
+