Skip to content

Commit d42fdac

Browse files
committed
add to tests
1 parent 643d300 commit d42fdac

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pandas/core/config_init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ def register_converter_cb(key):
796796

797797
def _is_formatter(x):
798798
if not (x is None or callable(x) or isinstance(x, (dict, str))):
799-
return ValueError("Value must have type 'callable, dict, str' or None.")
799+
raise ValueError("Value must have type 'callable, dict, str' or None.")
800800

801801

802802
with cf.config_prefix("styler"):

pandas/tests/io/formats/style/test_format.py

+5
Original file line numberDiff line numberDiff line change
@@ -310,3 +310,8 @@ def test_format_options_validator():
310310
assert " 9.0 " in df.style.to_latex()
311311
with option_context("styler.format.formatter", None):
312312
assert " 9 " in df.style.to_latex()
313+
314+
msg = "Value must have type"
315+
with pytest.raises(ValueError, match=msg):
316+
with option_context("styler.format.formatter", ["bad", "type"]):
317+
df.style.to_latex()

0 commit comments

Comments
 (0)