Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pvk-developer committed Jul 30, 2024
1 parent 8d06d76 commit bced9c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
4 changes: 2 additions & 2 deletions sdv/metadata/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

DEFAULT_TABLE_NAME = 'default_table_name'
SINGLE_DEPRECATION_MSG = (
"'SingleTableMetadata' is deprecated. Please " "use the new 'Metadata' class for synthesizers."
"'SingleTableMetadata' is deprecated. Please use the new 'Metadata' class for synthesizers."
)
MULTI_DEPRECATION_MSG = (
"'MultiTableMetadata' is deprecated. Please " "use the new 'Metadata' class for synthesizers."
"'MultiTableMetadata' is deprecated. Please use the new 'Metadata' class for synthesizers."
)


Expand Down
24 changes: 2 additions & 22 deletions tests/integration/lite/test_single_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def test_sample_with_constraints():
def test_warnings_are_shown():
"""Test all actions with SingleTablePreset gives a FutureWarning"""
warn_message = (
"The 'SingleTablePreset' is deprecated. For equivalent Fast ML "
"functionality, please use the 'GaussianCopulaSynthesizer'."
"'SingleTableMetadata' is deprecated. Please use the new 'Metadata' class for synthesizers."
)
# Setup
data = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
Expand All @@ -61,23 +60,4 @@ def test_warnings_are_shown():
metadata.detect_from_dataframe(data)

with pytest.warns(FutureWarning, match=warn_message):
preset = SingleTablePreset(metadata, name='FAST_ML')

constraints = [
{
'constraint_class': 'Inequality',
'constraint_parameters': {'low_column_name': 'a', 'high_column_name': 'b'},
}
]
with pytest.warns(FutureWarning, match=warn_message):
preset.add_constraints(constraints)

with pytest.warns(FutureWarning, match=warn_message):
preset.fit(data)

with pytest.warns(FutureWarning, match=warn_message):
samples = preset.sample(num_rows=10, max_tries_per_batch=20, batch_size=5)

# Assert
assert len(samples) == 10
assert all(samples['a'] < samples['b'])
SingleTablePreset(metadata, name='FAST_ML')

0 comments on commit bced9c1

Please sign in to comment.