Example #1
0
 def intdigest(self):
     return self.h and bin_to_num(self.h)
Example #2
0
 def intdigest(self):
     return self.h and int(bin_to_num(self.h))
 def test_num_to_bin_bin_to_num_is_idempotent(self):
     expected = b'\x06\x00\x00\x9c\xbf\xeb\x83\xdb'
     result = num_to_bin(bin_to_num(b'\x06\x00\x00\x9c\xbf\xeb\x83\xdb'))
     assert expected == result
Example #4
0
 def intdigest(self):
     if self.hd:
         return codec.bin_to_num(self.hd)
 def test_bin_to_num_large_number(self):
     expected = 432346237462348763
     result = bin_to_num(b'\x06\x00\x00\x9c\xbf\xeb\x83\xdb')
     assert expected == result
 def test_bin_to_num_and_num_to_bin_is_idempotent(self):
     expected = 432346237462348763
     result = bin_to_num(num_to_bin(432346237462348763))
     assert expected == result
 def test_bin_to_num_basic(self):
     expected = 123
     result = bin_to_num(b'{')
     assert expected == result
 def test_bin_to_num_zero(self):
     expected = 0
     result = bin_to_num(b'\x00')
     assert expected == result
Example #9
0
 def test_num_to_bin_bin_to_num_is_idempotent(self):
     expected = '\x06\x00\x00\x9c\xbf\xeb\x83\xdb'
     result = num_to_bin(bin_to_num('\x06\x00\x00\x9c\xbf\xeb\x83\xdb'))
     assert expected == result
 def test_bin_to_num_null(self):
     expected = 0
     result = bin_to_num('\x00')
     assert expected == result
Example #11
0
 def test_bin_to_num_and_num_to_bin_is_idempotent(self):
     expected = 432346237462348763
     result = bin_to_num(num_to_bin(432346237462348763))
     assert expected == result
Example #12
0
 def test_bin_to_num_large_number(self):
     expected = 432346237462348763
     result = bin_to_num('\x06\x00\x00\x9c\xbf\xeb\x83\xdb')
     assert expected == result
Example #13
0
 def test_bin_to_num_null(self):
     expected = 0
     result = bin_to_num('\x00')
     assert expected == result
Example #14
0
 def test_bin_to_num_basic(self):
     expected = 123
     result = bin_to_num('{')
     assert expected == result
Example #15
0
 def intdigest(self):
     if self.hd:
         return codec.bin_to_num(self.hd)