Skip to content

Commit 34d883f

Browse files
committed
updated json_normalize tests
1 parent 501337e commit 34d883f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pandas/tests/io/json/test_normalize.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def test_empty_array(self):
166166
[
167167
([{"a": 0}, {"a": 1}], None, None),
168168
({"a": [{"a": 0}, {"a": 1}]}, "a", None),
169-
('{"a": [{"a": 0}, {"a": 1}]}', None, NotImplementedError),
169+
('{"a": [{"a": 0}, {"a": 1}]}', None, None),
170170
(None, None, NotImplementedError),
171171
],
172172
)
@@ -630,15 +630,18 @@ def test_series_json_string_with_index(self):
630630
tm.assert_frame_equal(result, expected)
631631

632632
def test_invalid_json_string(self):
633-
invalid_json = '{"id": 1, "name": {"first": "John", "last": "Doe"'
633+
incomplete_json = '{"id": 1, "name": {"first": "John", "last": "Doe"'
634634
with pytest.raises(json.JSONDecodeError):
635-
json_normalize(invalid_json)
635+
json_normalize(incomplete_json)
636636

637-
def test_non_json_string(self):
638637
non_json = "Hello World"
639638
with pytest.raises(json.JSONDecodeError):
640639
json_normalize(non_json)
641640

641+
malformed_json = '{"a": 1,}'
642+
with pytest.raises(json.JSONDecodeError):
643+
json_normalize(malformed_json)
644+
642645

643646
class TestNestedToRecord:
644647
def test_flat_stays_flat(self):

0 commit comments

Comments
 (0)