(name)
| 50 | |
| 51 | |
| 52 | def load_test_vectors(name): |
| 53 | with open(os.path.dirname(__file__) + '/data/' + name, 'r') as fd: |
| 54 | for test_case in json.load(fd): |
| 55 | if len(test_case) == 1: |
| 56 | continue # comment |
| 57 | |
| 58 | if len(test_case) == 3: |
| 59 | test_case.append('') # add missing comment |
| 60 | |
| 61 | scriptSig, scriptPubKey, flags, comment = test_case |
| 62 | |
| 63 | scriptSig = parse_script(scriptSig) |
| 64 | scriptPubKey = parse_script(scriptPubKey) |
| 65 | |
| 66 | flag_set = set() |
| 67 | for flag in flags.split(','): |
| 68 | if flag == '' or flag == 'NONE': |
| 69 | pass |
| 70 | |
| 71 | else: |
| 72 | try: |
| 73 | flag = SCRIPT_VERIFY_FLAGS_BY_NAME[flag] |
| 74 | except IndexError: |
| 75 | raise Exception('Unknown script verify flag %r' % flag) |
| 76 | |
| 77 | flag_set.add(flag) |
| 78 | |
| 79 | yield (scriptSig, scriptPubKey, flag_set, comment, test_case) |
| 80 | |
| 81 | |
| 82 | class Test_EvalScript(unittest.TestCase): |
no test coverage detected