Skip to content

Commit

Permalink
Merge branch 'issue_2128_use_metadata_over_single' into issue_2129_me…
Browse files Browse the repository at this point in the history
…tadata_over_multi
  • Loading branch information
lajohn4747 committed Jul 26, 2024
2 parents 8d5547e + a3ed4c8 commit 82819af
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/integration/metadata/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,31 @@ def test_detect_table_from_csv(tmp_path):
def test_single_table_compatibility(tmp_path):
"""Test if SingleMetadataTable still has compatibility with single table synthesizers."""
# Setup
data, metadata = download_demo('single_table', 'fake_hotel_guests')
data, _ = download_demo('single_table', 'fake_hotel_guests')
warn_msg = (
"The 'SingleTableMetadata' is deprecated. Please use the new "
"'Metadata' class for synthesizers."
)

# Run
single_table_metadata_dict = {
'primary_key': 'guest_email',
'METADATA_SPEC_VERSION': 'SINGLE_TABLE_V1',
'columns': {
'guest_email': {'sdtype': 'email', 'pii': True},
'has_rewards': {'sdtype': 'boolean'},
'room_type': {'sdtype': 'categorical'},
'amenities_fee': {'sdtype': 'numerical', 'computer_representation': 'Float'},
'checkin_date': {'sdtype': 'datetime', 'datetime_format': '%d %b %Y'},
'checkout_date': {'sdtype': 'datetime', 'datetime_format': '%d %b %Y'},
'room_rate': {'sdtype': 'numerical', 'computer_representation': 'Float'},
'billing_address': {'sdtype': 'address', 'pii': True},
'credit_card_number': {'sdtype': 'credit_card_number', 'pii': True},
},
}
metadata = SingleTableMetadata.load_from_dict(single_table_metadata_dict)
assert isinstance(metadata, SingleTableMetadata)

# Run
with pytest.warns(FutureWarning, match=warn_msg):
synthesizer = GaussianCopulaSynthesizer(metadata)
synthesizer.fit(data)
Expand Down

0 comments on commit 82819af

Please sign in to comment.