Skip to content

Commit 16ec8d6

Browse files
code change based on review
1 parent 4ffa308 commit 16ec8d6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pandas/plotting/_core.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,10 @@ def _setup_subplots(self):
308308

309309
axes = _flatten(axes)
310310

311-
valid_log = (False, True, 'sym', None)
312-
313-
for i in (self.logx, self.logy, self.loglog):
314-
if i not in valid_log:
315-
raise ValueError("Valid inputs are boolean, None and 'sym'.")
311+
valid_log = {False, True, 'sym', None}
312+
input_log = {self.logx, self.logy, self.loglog}
313+
if input_log - valid_log:
314+
raise ValueError("Valid inputs are boolean, None and 'sym'.")
316315

317316
if self.logx is True or self.loglog is True:
318317
[a.set_xscale('log') for a in axes]

pandas/tests/plotting/test_frame.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,13 @@ def test_logscales(self):
259259
assert ax.get_yscale() == 'symlog'
260260

261261
@pytest.mark.parametrize("wrong_input", ["sm", "symlog"])
262-
def test_invalid_logscale(self, wrong_input):
262+
@pytest.mark.parametrize("input_param", ["logx", "logy", "loglog"])
263+
def test_invalid_logscale(self, wrong_input, input_param):
263264
df = DataFrame({'a': np.arange(100)}, index=np.arange(100))
264265

265266
msg = "Valid inputs are boolean, None and 'sym'."
266267
with pytest.raises(ValueError, match=msg):
267-
df.plot(logy=wrong_input)
268+
df.plot(**{input_param: wrong_input})
268269

269270
@pytest.mark.slow
270271
def test_xcompat(self):

0 commit comments

Comments
 (0)