Skip to content

Commit ff05fff

Browse files
authored
TST: GH30999 add match=msg to 2 pytest.raises in pandas/tests/io/json/test_normalize.py (#38864)
1 parent 160e3f3 commit ff05fff

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pandas/tests/io/json/test_normalize.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from contextlib import nullcontext as does_not_raise
21
import json
32

43
import numpy as np
@@ -170,19 +169,21 @@ def test_empty_array(self):
170169
tm.assert_frame_equal(result, expected)
171170

172171
@pytest.mark.parametrize(
173-
"data, record_path, error",
172+
"data, record_path, exception_type",
174173
[
175-
([{"a": 0}, {"a": 1}], None, does_not_raise()),
176-
({"a": [{"a": 0}, {"a": 1}]}, "a", does_not_raise()),
177-
('{"a": [{"a": 0}, {"a": 1}]}', None, pytest.raises(NotImplementedError)),
178-
(None, None, pytest.raises(NotImplementedError)),
174+
([{"a": 0}, {"a": 1}], None, None),
175+
({"a": [{"a": 0}, {"a": 1}]}, "a", None),
176+
('{"a": [{"a": 0}, {"a": 1}]}', None, NotImplementedError),
177+
(None, None, NotImplementedError),
179178
],
180179
)
181-
def test_accepted_input(self, data, record_path, error):
182-
with error:
180+
def test_accepted_input(self, data, record_path, exception_type):
181+
if exception_type is not None:
182+
with pytest.raises(exception_type, match=tm.EMPTY_STRING_PATTERN):
183+
json_normalize(data, record_path=record_path)
184+
else:
183185
result = json_normalize(data, record_path=record_path)
184186
expected = DataFrame([0, 1], columns=["a"])
185-
186187
tm.assert_frame_equal(result, expected)
187188

188189
def test_simple_normalize_with_separator(self, deep_nested):

0 commit comments

Comments
 (0)