(input_paths, output_path)
| 151 | |
| 152 | print("Example 5") |
| 153 | def confirm_merge(input_paths, output_path): |
| 154 | found = collections.defaultdict(list) |
| 155 | with open(output_path, "rb") as f: |
| 156 | for line in f: |
| 157 | for path in input_paths: |
| 158 | if line.find(path.encode()) == 0: |
| 159 | found[path].append(line) |
| 160 | |
| 161 | expected = collections.defaultdict(list) |
| 162 | for path in input_paths: |
| 163 | with open(path, "rb") as f: |
| 164 | expected[path].extend(f.readlines()) |
| 165 | |
| 166 | for key, expected_lines in expected.items(): |
| 167 | found_lines = found[key] |
| 168 | assert ( |
| 169 | expected_lines == found_lines |
| 170 | ), f"{expected_lines!r} == {found_lines!r}" |
| 171 | |
| 172 | input_paths = ... |
| 173 | handles = ... |
no test coverage detected