-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
435 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
tests/integration/reports/multi_table/_properties/test_inter_table_trends.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from unittest.mock import Mock | ||
|
||
from tqdm import tqdm | ||
|
||
from sdmetrics.demos import load_demo | ||
from sdmetrics.reports.multi_table._properties import InterTableTrends | ||
|
||
|
||
class TestInterTableTrends: | ||
|
||
def test_end_to_end(self): | ||
"""Test ``ColumnPairTrends`` multi-table property end to end.""" | ||
# Setup | ||
real_data, synthetic_data, metadata = load_demo(modality='multi_table') | ||
column_pair_trends = InterTableTrends() | ||
|
||
# Run | ||
result = column_pair_trends.get_score(real_data, synthetic_data, metadata) | ||
|
||
# Assert | ||
assert result == 0.48240740740740734 | ||
|
||
def test_with_progress_bar(self): | ||
"""Test that the progress bar is correctly updated.""" | ||
# Setup | ||
real_data, synthetic_data, metadata = load_demo(modality='multi_table') | ||
column_pair_trends = InterTableTrends() | ||
num_iter = sum( | ||
len(metadata['tables'][relationship['parent_table_name']]['columns']) | ||
* len(metadata['tables'][relationship['child_table_name']]['columns']) # noqa: W503 | ||
for relationship in metadata['relationships'] | ||
) | ||
|
||
progress_bar = tqdm(total=num_iter) | ||
mock_update = Mock() | ||
progress_bar.update = mock_update | ||
|
||
# Run | ||
result = column_pair_trends.get_score(real_data, synthetic_data, metadata, progress_bar) | ||
|
||
# Assert | ||
assert result == 0.48240740740740734 | ||
assert mock_update.call_count == num_iter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.