Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21a74f4

Browse files
committed
Removed unneccacery notes from test_rcparams.py
1 parent 328f0cb commit 21a74f4

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -733,24 +733,24 @@ def validate_legend_loc(loc):
733733
loc : str | int | (float, float) or raise ValueError exception
734734
The location of the legend.
735735
"""
736-
valid = [
736+
valid = {
737737
"best",
738738
"upper right", "upper left", "lower left", "lower right", "right",
739739
"center left", "center right", "lower center", "upper center",
740740
"center"
741-
]
742-
valid = {k: k for k in valid}
741+
}
742+
743743
key = "legend.loc"
744744
msg = (f"{loc!r} is not a valid value for {key}; supported values "
745-
f"are {[*valid.values()]} | tuple(float, float) "
745+
f"are {', '.join(valid)} | tuple(float, float) "
746746
f"| str(tuple(float, float))")
747747

748748
if isinstance(loc, int):
749749
return loc
750750
if isinstance(loc, str):
751751
loc = loc.lower()
752752
if loc in valid:
753-
return valid[loc]
753+
return loc
754754
if (loc.startswith('"') and loc.endswith('"')
755755
or loc.startswith("'") and loc.endswith("'")) \
756756
and loc[1:-1] in valid:

lib/matplotlib/tests/test_rcparams.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -591,12 +591,6 @@ def test_deprecation(monkeypatch):
591591
# suppress_matplotlib_deprecation_warning, rather than any explicit check.
592592

593593

594-
# def test_rcparams_legend_loc():
595-
# value = (0.9, .7)
596-
# match_str = f"{value} is not a valid value for legend.loc;"
597-
# with pytest.raises(ValueError, match=re.escape(match_str)):
598-
# mpl.RcParams({'legend.loc': value})
599-
600594
@pytest.mark.parametrize('value', [
601595
1,
602596
(0.9, .7),

0 commit comments

Comments
 (0)