Skip to content

Commit 9fd073c

Browse files
committed
Add test
1 parent ba820d0 commit 9fd073c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/unit/datasets/test_demo.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,14 @@ def test__get_metadata_warns_on_save_error(_mock_open, tmp_path):
613613
assert md.to_dict() == meta
614614

615615

616+
def test__get_metadata_raises_on_invalid_json():
617+
"""_get_metadata should raise a helpful error when JSON is invalid."""
618+
# Run / Assert
619+
err = 'Failed to parse metadata JSON for the dataset.'
620+
with pytest.raises(DemoResourceNotFoundError, match=re.escape(err)):
621+
_get_metadata(b'not-json', 'dataset1')
622+
623+
616624
@patch('sdv.datasets.demo._get_data_from_bucket')
617625
@patch('sdv.datasets.demo._list_objects')
618626
def test_download_demo_writes_metadata_and_discovers_nested_csv(mock_list, mock_get, tmp_path):

0 commit comments

Comments
 (0)