-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Description
Noticed a very rare issue with the regression line assertions. The assertion has this line to ensure that all x values are within the range of the expected line.
if min(line_x_vals) <= min_val and max(line_x_vals) >= max_val:
Very rarely, matplotlib will be off in the wrong direction by .000000000000001, as seen here:
7.000000000000001 7.0 24.0 24.0
False True
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-10-123ae72b3d52> in <module>
99
100 # Check line is correct
--> 101 line_figure_tests.assert_line(slope_exp=slope_data, intercept_exp=intercept_data)
~/GitHub/matplotcheck/matplotcheck/base.py in assert_line(self, slope_exp, intercept_exp, xtime, message_no_line, message_data)
1106
1107 assert flag_exist, message_no_line
-> 1108 assert flag_length, message_data
1109
1110 def assert_lines_of_type(self, line_types):
AssertionError: Line does not cover data set
A possible fix would be to use math.isclose() instead of the <= comparisons? Not sure. Very rare occurrence but common enough it's failing my lines vignette PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels