Skip to content

Commit 109e759

Browse files
Marvvxitimhoffm
andauthored
Update lib/matplotlib/tests/test_legend.py
Legend: Refactoring actual labels Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent 41fd7f5 commit 109e759

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/matplotlib/tests/test_legend.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,8 @@ def test_reverse_legend():
302302

303303
ax.plot(x, y, label=labels)
304304
leg = ax.legend(reverse=True)
305-
actual_labels = []
306-
for text in leg.get_texts():
307-
actual_labels.append(text.get_text())
308-
excepted_labels = list(reversed(labels))
309-
assert actual_labels == excepted_labels
305+
actual_labels = [t.get_gext() for t in leg.get_texts()]
306+
assert actual_labels == list(reversed(labels))
310307

311308

312309
class TestLegendFunction:

0 commit comments

Comments
 (0)