예제 #1
0
 def test_cidv1_eq_cidv0(self):
     """ check for equality between converted v1 to v0 """
     assert CIDv1(CIDv0.CODEC, test_hash).to_v0() == CIDv0(test_hash)
예제 #2
0
 def test_is_cid_valid(self, test_hash):
     assert is_cid(CIDv0(test_hash).encode())
예제 #3
0
 def test_cidv0_eq_cidv1(self, test_hash):
     """ check for equality between converted v0 to v1 """
     assert CIDv0(test_hash).to_v1() == CIDv1(CIDv0.CODEC, test_hash)
예제 #4
0
 def test_cidv0_neq(self):
     """ check for inequality for CIDv0 for different hashes """
     assert CIDv0(b'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n') != \
         CIDv0(b'QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1o')
예제 #5
0
 def test_cidv0_eq_cidv0(self, test_hash):
     """ check for equality for CIDv0 for same hash """
     assert CIDv0(test_hash) == make_cid(CIDv0(test_hash).encode())
예제 #6
0
 def cid(self, test_hash):
     return CIDv0(test_hash)
예제 #7
0
 def test_hash(self, test_hash):
     """ make_cid: make_cid works with base-encoded hash """
     assert make_cid(base58.b58encode(test_hash)) == CIDv0(test_hash)