Skip to content

Commit 7db8ecd

Browse files
committed
Updated tests for removed datasets
1 parent 0c1777a commit 7db8ecd

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

tests/integration/datasets/test_demo.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pandas as pd
22

3-
from sdv.datasets.demo import get_available_demos, get_readme, get_source
3+
from sdv.datasets.demo import get_available_demos
44

55

66
def test_get_available_demos_single_table():
@@ -85,30 +85,3 @@ def test_get_available_demos_multi_table():
8585
'num_tables': [2, 2],
8686
})
8787
pd.testing.assert_frame_equal(tables_info[['dataset_name', 'size_MB', 'num_tables']], expected)
88-
89-
90-
def test_get_readme_and_source_single_table_dataset1(tmp_path):
91-
"""Test it returns the README and SOURCE for a single table dataset."""
92-
# Run
93-
readme = get_readme('single_table', 'dataset1')
94-
source = get_source('single_table', 'dataset1')
95-
96-
# Assert
97-
assert isinstance(readme, str) and 'sample dataset' in readme.lower()
98-
assert isinstance(source, str) and source.strip() == 'unknown'
99-
100-
readme_out = tmp_path / 'r.txt'
101-
source_out = tmp_path / 's.txt'
102-
readme2 = get_readme('single_table', 'dataset1', str(readme_out))
103-
source2 = get_source('single_table', 'dataset1', str(source_out))
104-
assert readme2 == readme
105-
assert source2 == source
106-
assert readme_out.read_text(encoding='utf-8').strip() == readme.strip()
107-
assert source_out.read_text(encoding='utf-8').strip() == source.strip()
108-
109-
110-
def test_get_readme_missing_returns_none():
111-
"""Test it returns None when the README/SOURCE is missing."""
112-
# Run and Assert
113-
assert get_readme('single_table', 'dataset2') is None
114-
assert get_source('single_table', 'dataset2') is None

tests/unit/datasets/test_demo.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,18 +342,16 @@ def test_get_available_demos_invalid_modality():
342342
def test__find_data_zip_key():
343343
# Setup
344344
contents = [
345-
{'Key': 'single_table/dataset/data.ZIP'},
346-
{'Key': 'single_table/dataset/metadata.json'},
347-
{'Key': 'single_table/dataset/aaa_wrong.json'},
348-
{'Key': 'single_table/dataset/README.txt'},
345+
{'Key': 'single_table/fake_hotel_guests/data.ZIP'},
346+
{'Key': 'single_table/fake_hotel_guests/metadata.json'},
349347
]
350-
dataset_prefix = 'single_table/dataset/'
348+
dataset_prefix = 'single_table/fake_hotel_guests/'
351349

352350
# Run
353351
zip_key = _find_data_zip_key(contents, dataset_prefix)
354352

355353
# Assert
356-
assert zip_key == 'single_table/dataset/data.ZIP'
354+
assert zip_key == 'single_table/fake_hotel_guests/data.ZIP'
357355

358356

359357
@patch('sdv.datasets.demo._get_data_from_bucket')

0 commit comments

Comments
 (0)