Parse the AutoResearchLpc ws2812SctTest CSV reply. Format (must match the sketch handler): success,test_case,num_leds,exp_bytes,dec_bytes,matched,mismatched,edges
(csv: str)
| 109 | |
| 110 | |
| 111 | def parse_csv_result(csv: str) -> dict[str, int]: |
| 112 | """Parse the AutoResearchLpc ws2812SctTest CSV reply. |
| 113 | |
| 114 | Format (must match the sketch handler): |
| 115 | success,test_case,num_leds,exp_bytes,dec_bytes,matched,mismatched,edges |
| 116 | """ |
| 117 | fields = ( |
| 118 | "success", |
| 119 | "test_case", |
| 120 | "num_leds", |
| 121 | "exp_bytes", |
| 122 | "dec_bytes", |
| 123 | "matched", |
| 124 | "mismatched", |
| 125 | "edges", |
| 126 | ) |
| 127 | parts = csv.split(",") |
| 128 | if len(parts) != len(fields): |
| 129 | return {} |
| 130 | try: |
| 131 | return {k: int(v) for k, v in zip(fields, parts)} |
| 132 | except ValueError: |
| 133 | return {} |
| 134 | |
| 135 | |
| 136 | def evaluate(case: TestCase, parsed: dict[str, int]) -> tuple[bool, str]: |