Small assertion-side splitter for the already-expected four-field wire.
(wire)
| 97 | |
| 98 | |
| 99 | def row_view(wire): |
| 100 | """Small assertion-side splitter for the already-expected four-field wire.""" |
| 101 | if wire and (not wire.endswith(b"\n") or b"\r" in wire or b"\0" in wire): |
| 102 | raise AssertionError("producer test wire has unsupported record delimiters") |
| 103 | rows = {} |
| 104 | for line in wire.split(b"\n")[:-1]: |
| 105 | key, state, reason, ids = line.split(b"\t") |
| 106 | if key in rows: |
| 107 | raise AssertionError("producer duplicated an expected row") |
| 108 | rows[key] = (state, reason, ids) |
| 109 | return rows |
| 110 | |
| 111 | |
| 112 | class CountCancel: |