diff --git a/mlair/plotting/tracker_plot.py b/mlair/plotting/tracker_plot.py index 406c32feb1ebda2d32d886051e32778d6c17f5db..53ec7496e7e04da0f53b1d0ce817793dea732963 100644 --- a/mlair/plotting/tracker_plot.py +++ b/mlair/plotting/tracker_plot.py @@ -119,11 +119,13 @@ class TrackChain: control_obj = control[variable][scope] if method == "set": track_objects = self._add_set_object(track_objects, tr, control_obj) - elif method == "get": + elif method == "get": # pragma: no branch track_objects, skip_control_update = self._add_get_object(track_objects, tr, control_obj, control, scope, variable) if skip_control_update is True: continue + else: # pragma: no cover + raise ValueError(f"method must be either set or get but given was {method}.") self._update_control(control, variable, scope, tr) return track_objects, control diff --git a/test/test_plotting/test_tracker_plot.py b/test/test_plotting/test_tracker_plot.py index 9587e71352dd4648009a72a7046c2b068dd5584d..62e171fe75c1112bb96447e9831b0008269fac7b 100644 --- a/test/test_plotting/test_tracker_plot.py +++ b/test/test_plotting/test_tracker_plot.py @@ -392,20 +392,18 @@ class TestTrackPlot: track_plot_obj.rect(x=4, y=2) assert len(track_plot_obj.ax.artists) == 1 assert len(track_plot_obj.ax.texts) == 1 - track_plot_obj.ax.artists[0].xy == (4, 2) - track_plot_obj.ax.artists[0]._height == h - track_plot_obj.ax.artists[0]._width == w - track_plot_obj.ax.artists[0]._original_facecolor == "orange" - track_plot_obj.ax.texts[0].xy == (4 + w / 2, 2 + h / 2) - track_plot_obj.ax.texts[0]._color == "w" - track_plot_obj.ax.texts[0]._text == "get" + assert track_plot_obj.ax.artists[0].xy == (4, 2) + assert track_plot_obj.ax.artists[0]._height == h + assert track_plot_obj.ax.artists[0]._width == w + assert track_plot_obj.ax.artists[0]._original_facecolor == "orange" + assert track_plot_obj.ax.texts[0].xy == (4 + w / 2, 2 + h / 2) + assert track_plot_obj.ax.texts[0]._color == "w" + assert track_plot_obj.ax.texts[0]._text == "get" track_plot_obj.rect(x=4, y=2, method="set") assert len(track_plot_obj.ax.artists) == 2 assert len(track_plot_obj.ax.texts) == 2 - track_plot_obj.ax.artists[0]._original_facecolor == "lightblue" - track_plot_obj.ax.texts[0]._text == "set" - - + assert track_plot_obj.ax.artists[1]._original_facecolor == "lightblue" + assert track_plot_obj.ax.texts[1]._text == "set" def test_set_ypos_anchor(self, track_plot_obj, scopes, dims): assert not hasattr(track_plot_obj, "y_pos")