Commit d01b886
committed
Enforce Child dispatch exhaustiveness with assert_never, drop the mock test
assert_never on the Child dataclass itself does not typecheck: mypy cannot
prove exhaustiveness from attribute patterns on a class with three optional
fields, so the fall-through arm keeps the type "Child" instead of "Never".
Matching on `child.background or child.rule or child.scenario` gives mypy a
proper union (Background | Rule | Scenario | None) to exhaust; removing any
arm is now a mypy error.
Both defensive arms (empty Child, assert_never) are unreachable with the
current gherkin version, so they are excluded from coverage instead of being
exercised through a monkeypatched document, and the mock-based test is
removed. "pragma: no cover" is re-added to coverage's exclude_lines: setting
exclude_lines in the config replaces coverage.py's defaults, so the pragma
had silently stopped working.1 parent 60c2862 commit d01b886
3 files changed
Lines changed: 14 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | | - | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
492 | 494 | | |
493 | 495 | | |
494 | 496 | | |
495 | | - | |
496 | | - | |
| 497 | + | |
| 498 | + | |
497 | 499 | | |
498 | | - | |
| 500 | + | |
499 | 501 | | |
500 | | - | |
| 502 | + | |
501 | 503 | | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
502 | 510 | | |
503 | 511 | | |
504 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
853 | 851 | | |
854 | 852 | | |
855 | 853 | | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | | - | |
0 commit comments