-
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
3 changed files
with
43 additions
and
4 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
39 changes: 39 additions & 0 deletions
39
tests/integration/reports/multi_table/_properties/test_relationship_validity.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,39 @@ | ||
from unittest.mock import Mock | ||
|
||
from tqdm import tqdm | ||
|
||
from sdmetrics.demos import load_demo | ||
from sdmetrics.reports.multi_table._properties import RelationshipValidity | ||
|
||
|
||
class TestRelationshipValidity: | ||
|
||
def test_end_to_end(self): | ||
"""Test the ``RelationshipValidity`` multi-table property end to end.""" | ||
# Setup | ||
real_data, synthetic_data, metadata = load_demo(modality='multi_table') | ||
relationship_validity = RelationshipValidity() | ||
|
||
# Run | ||
result = relationship_validity.get_score(real_data, synthetic_data, metadata) | ||
|
||
# Assert | ||
assert result == 1.0 | ||
|
||
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') | ||
relationship_validity = RelationshipValidity() | ||
num_relationship = 2 | ||
|
||
progress_bar = tqdm(total=num_relationship) | ||
mock_update = Mock() | ||
progress_bar.update = mock_update | ||
|
||
# Run | ||
result = relationship_validity.get_score(real_data, synthetic_data, metadata, progress_bar) | ||
|
||
# Assert | ||
assert result == 1.0 | ||
assert mock_update.call_count == num_relationship |
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