(self)
| 40 | self.fail('Wrong witver: %d' % witver) |
| 41 | |
| 42 | def test_encode_decode(self): |
| 43 | for exp_bin, exp_bech32 in load_test_vectors('bech32_encode_decode.json'): |
| 44 | exp_bin = unhexlify(exp_bin.encode('utf8')) |
| 45 | witver = self.op_decode(exp_bin[0]) |
| 46 | hrp = exp_bech32[:exp_bech32.rindex('1')].lower() |
| 47 | self.assertEqual(exp_bin[1], len(exp_bin[2:])) |
| 48 | act_bech32 = encode(hrp, witver, exp_bin[2:]) |
| 49 | act_bin = decode(hrp, exp_bech32) |
| 50 | |
| 51 | self.assertEqual(act_bech32.lower(), exp_bech32.lower()) |
| 52 | self.assertEqual(to_scriptPubKey(*act_bin), bytes(exp_bin)) |
| 53 | |
| 54 | class Test_CBech32Data(unittest.TestCase): |
| 55 | def test_from_data(self): |
nothing calls this directly
no test coverage detected