Commit 2fa75e6
committed
Three ways a mistyped config reaches something worse than an error
These are on the other side of the line from the ones taken out last commit.
Nothing here needs an unusual number, only a config file with a typo in it, and
two of the three say nothing at all when it happens.
`actuator_range` was read by index, so its shape was never checked. Three
endpoints dropped the third in silence, one raised IndexError, a bare float
raised TypeError, and string endpoints, which is what a YAML value without
quotes handling looks like, failed inside np.clip with a ufunc loop error. It
is now a pair of numbers or a ValueError naming the endpoint. Lists and numpy
scalars still work, and an infinite bound still means unbounded.
Each `add_*_control` removed the existing controller before building its
replacement. A second call with a rejected argument then left the rocket
carrying an actuator that simulation would never call, with no error after the
one that caused it: measured, `sampling_rate=-1` on a second call took the
controller list from one entry to zero while `throttle_control` stayed set. Both
halves are built first now.
`demand_rate=None` with a rate limit or a time constant was accepted with a
warning and then ignored. Asking for a 0.1 s lag and getting an instant response
is worth stopping for, and the subclass docstrings already say a demand rate is
required for those options. It raises at construction now.
Four mutations, one per fix, each fail a named test. 122 tests, up from 104.
pylint exits 0: rocket.py was one line over its 3050 limit after this, so the
comments came down to two lines each.
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>1 parent 36bda41 commit 2fa75e6
3 files changed
Lines changed: 138 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
50 | 66 | | |
51 | 67 | | |
52 | 68 | | |
| |||
105 | 121 | | |
106 | 122 | | |
107 | 123 | | |
108 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
109 | 129 | | |
110 | | - | |
| 130 | + | |
| 131 | + | |
111 | 132 | | |
112 | 133 | | |
113 | 134 | | |
| |||
118 | 139 | | |
119 | 140 | | |
120 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
121 | 157 | | |
122 | 158 | | |
123 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2075 | 2075 | | |
2076 | 2076 | | |
2077 | 2077 | | |
2078 | | - | |
2079 | | - | |
2080 | | - | |
2081 | | - | |
2082 | | - | |
2083 | | - | |
2084 | | - | |
2085 | 2078 | | |
2086 | 2079 | | |
2087 | 2080 | | |
| |||
2113 | 2106 | | |
2114 | 2107 | | |
2115 | 2108 | | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
2116 | 2116 | | |
2117 | 2117 | | |
2118 | 2118 | | |
| |||
2224 | 2224 | | |
2225 | 2225 | | |
2226 | 2226 | | |
2227 | | - | |
2228 | | - | |
2229 | | - | |
2230 | | - | |
2231 | | - | |
2232 | 2227 | | |
2233 | 2228 | | |
2234 | 2229 | | |
| |||
2247 | 2242 | | |
2248 | 2243 | | |
2249 | 2244 | | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
2250 | 2252 | | |
2251 | 2253 | | |
2252 | 2254 | | |
| |||
2360 | 2362 | | |
2361 | 2363 | | |
2362 | 2364 | | |
2363 | | - | |
2364 | | - | |
2365 | | - | |
2366 | | - | |
2367 | | - | |
2368 | 2365 | | |
2369 | 2366 | | |
2370 | 2367 | | |
| |||
2385 | 2382 | | |
2386 | 2383 | | |
2387 | 2384 | | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
2388 | 2392 | | |
2389 | 2393 | | |
2390 | 2394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
724 | 761 | | |
725 | 762 | | |
726 | 763 | | |
| |||
787 | 824 | | |
788 | 825 | | |
789 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
0 commit comments