Skip to content

Commit f513bdb

Browse files
committed
DEP: add testing dependency (cycler)
1 parent 79b0f08 commit f513bdb

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ dependencies:
5252
- botocore>=1.11
5353
- hypothesis>=3.82
5454
- moto # mock S3
55+
- cycler # test matplotlib colors cycle
5556
- flask
5657
- pytest>=5.0.1
5758
- pytest-cov

pandas/plotting/_matplotlib/style.py

-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ def _gen_list_of_colors_from_iterable(color: Collection[Color]) -> Iterator[Colo
123123
Yield colors from string of several letters or from collection of colors.
124124
"""
125125
for x in color:
126-
if isinstance(x, str):
127-
# to avoid warnings on upper case single letter colors
128-
x = x.lower()
129126
if _is_single_color(x):
130127
yield x
131128
else:

pandas/tests/plotting/test_style.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
from cycler import cycler
2-
import matplotlib as mpl
3-
import matplotlib.colors
42
import pytest
53

64
from pandas import Series
@@ -20,6 +18,8 @@ class TestGetStandardColors:
2018
],
2119
)
2220
def test_default_colors_named_from_prop_cycle(self, num_colors, expected):
21+
import matplotlib as mpl
22+
2323
mpl_params = {
2424
"axes.prop_cycle": cycler(color=["red", "green", "blue"]),
2525
}
@@ -38,6 +38,8 @@ def test_default_colors_named_from_prop_cycle(self, num_colors, expected):
3838
],
3939
)
4040
def test_default_colors_named_from_prop_cycle_string(self, num_colors, expected):
41+
import matplotlib as mpl
42+
4143
mpl_params = {
4244
"axes.prop_cycle": cycler(color="bgry"),
4345
}
@@ -70,8 +72,11 @@ def test_default_colors_named_from_prop_cycle_string(self, num_colors, expected)
7072
],
7173
)
7274
def test_default_colors_named_undefined_prop_cycle(self, num_colors, expected_name):
75+
import matplotlib as mpl
76+
import matplotlib.colors as mcolors
77+
7378
with mpl.rc_context(rc={}):
74-
expected = [matplotlib.colors.to_hex(x) for x in expected_name]
79+
expected = [mcolors.to_hex(x) for x in expected_name]
7580
result = get_standard_colors(num_colors=num_colors)
7681
assert result == expected
7782

@@ -138,8 +143,8 @@ def test_empty_color_raises(self, color):
138143
@pytest.mark.parametrize(
139144
"color",
140145
[
141-
"BAD_COLOR",
142-
("red", "green", "BAD_COLOR"),
146+
"bad_color",
147+
("red", "green", "bad_color"),
143148
(0.1,),
144149
(0.1, 0.2),
145150
(0.1, 0.2, 0.3, 0.4, 0.5), # must be either 3 or 4 floats

0 commit comments

Comments
 (0)