()
| 110 | |
| 111 | |
| 112 | def test_marshal(): |
| 113 | import marshal |
| 114 | o = ("a", "b", "c", 1, 2, 3) |
| 115 | payload = marshal.dumps(o) |
| 116 | |
| 117 | with TestHook() as hook: |
| 118 | assertEqual(o, marshal.loads(marshal.dumps(o))) |
| 119 | |
| 120 | try: |
| 121 | with open("test-marshal.bin", "wb") as f: |
| 122 | marshal.dump(o, f) |
| 123 | with open("test-marshal.bin", "rb") as f: |
| 124 | assertEqual(o, marshal.load(f)) |
| 125 | finally: |
| 126 | os.unlink("test-marshal.bin") |
| 127 | |
| 128 | actual = [(a[0], a[1]) for e, a in hook.seen if e == "marshal.dumps"] |
| 129 | assertSequenceEqual(actual, [(o, marshal.version)] * 2) |
| 130 | |
| 131 | actual = [a[0] for e, a in hook.seen if e == "marshal.loads"] |
| 132 | assertSequenceEqual(actual, [payload]) |
| 133 | |
| 134 | actual = [e for e, a in hook.seen if e == "marshal.load"] |
| 135 | assertSequenceEqual(actual, ["marshal.load"]) |
| 136 | |
| 137 | |
| 138 | def test_pickle(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…