From 39f2b1ed19fbd5955d151f6d2e96b1ea1710b24c Mon Sep 17 00:00:00 2001
From: leufen1 <l.leufen@fz-juelich.de>
Date: Fri, 18 Dec 2020 10:42:11 +0100
Subject: [PATCH] coverage is now 100%, /close #243

---
 mlair/plotting/tracker_plot.py          |  4 +++-
 test/test_plotting/test_tracker_plot.py | 20 +++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/mlair/plotting/tracker_plot.py b/mlair/plotting/tracker_plot.py
index 406c32fe..53ec7496 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 9587e713..62e171fe 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")
-- 
GitLab