def test_is_hex_ok_block_hash(self): value = "0x54d81a25b240c013d1c0d0d2e7f240ba062c9291aec0c2370eba43a6968acdda" self.assertEqual(len(value[2:]), 64) self.assertTrue(app._is_hex(value))
def test_is_hex_block_hash_too_long(self): value = "0x54d81a25b240c013d1c0d0d2e7f240ba062c9291aec0c2370eba43a6968acdda0" self.assertGreater(len(value[2:]), 64) self.assertFalse(app._is_hex(value))
def test_is_hex_ok_single_char(self): for x in "0123456789abcdefABCDEF": self.assertTrue(app._is_hex("0x%s" % x, length=1))
def test_is_hex_incorrect_prefix(self): for x in "0123456789abcdefABCDEF": self.assertFalse(app._is_hex(x, length=1))