예제 #1
0
 def test_eq(self):
     self.assertEqual(
         PrivateAddress('00000000FE00007DF0'),
         PrivateAddress('00000000FE00007DF0')
     )
예제 #2
0
 def test_repr(self):
     self.assertEqual(
         repr(PrivateAddress('00000000FE00007DF0')),
         "PrivateAddress(addr='00000000FE00007DF0', hex='A0000000FE00007D')"
     )
예제 #3
0
 def test_str(self):
     self.assertEqual(
         str(PrivateAddress('00000000FE00007DF0')),
         "00000000FE00007DF0"
     )
예제 #4
0
 def test_bin_property(self):
     for addr in TEST_PRIV_ADDRS:
         with self.subTest(addr=addr):
             priv = PrivateAddress(addr['addr'])
             self.assertEqual(priv.bin, bytes.fromhex(addr['hex']))
예제 #5
0
 def test_hex_property(self):
     for addr in TEST_PRIV_ADDRS:
         with self.subTest(addr=addr):
             priv = PrivateAddress(addr['addr'])
             self.assertEqual(priv.hex, addr['hex'])
예제 #6
0
 def test_from_bin(self):
     for addr in TEST_PRIV_ADDRS:
         with self.subTest(addr=addr):
             priv1 = PrivateAddress.from_bin(addr['hex'])
             priv2 = PrivateAddress(addr['addr'])
             self.assertEqual(priv1, priv2)
예제 #7
0
 def test_bin2txt(self):
     for addr in TEST_PRIV_ADDRS:
         with self.subTest(addr=addr):
             txt_addr = PrivateAddress.bin2txt(addr['hex'])
             self.assertEqual(txt_addr, addr['addr'])
예제 #8
0
 def test_txt2bin(self):
     for addr in TEST_PRIV_ADDRS:
         with self.subTest(addr=addr):
             hex_addr = PrivateAddress.txt2bin(addr['addr'])
             self.assertEqual(hex_addr, addr['hex'])