Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fealho committed Jun 17, 2022
1 parent 8bd72e3 commit 1d6cef1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 7 additions & 6 deletions tests/unit/constraints/test_tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import pytest

from sdv.constraints.errors import MissingConstraintColumnError
from sdv.constraints.tabular import (create_custom_constraint,
from sdv.constraints.tabular import (
create_custom_constraint,
ColumnFormula, FixedCombinations, FixedIncrements, Inequality, Negative, OneHotEncoding,
Positive, Range, ScalarInequality, ScalarRange, Unique, _validate_inputs_custom_constraint)

Expand Down Expand Up @@ -184,8 +185,8 @@ def test_create_custom_constraint_transform(self):
- pd.DataFrame of transformed values.
"""
# Setup
valid = lambda _, x: pd.Series([True]*5)
square = lambda _, x: pd.DataFrame({'col': x['col']**2})
valid = lambda _, x: pd.Series([True] * 5)
square = lambda _, x: pd.DataFrame({'col': x['col'] ** 2})
custom_constraint = create_custom_constraint(valid, square, sorted)('col')
data = pd.DataFrame({'col': [-10, 1, 0, 3, -.5]})

Expand All @@ -195,7 +196,7 @@ def test_create_custom_constraint_transform(self):
# Assert
expected_out = pd.DataFrame({'col': [100, 1, 0, 9, .25]})
pd.testing.assert_frame_equal(transform_out, expected_out)

def test_create_custom_constraint_reverse_transform(self):
"""Test ``reverse_transform`` method of ``CustomConstraint``.
Expand All @@ -208,8 +209,8 @@ def test_create_custom_constraint_reverse_transform(self):
- pd.DataFrame of transformed values.
"""
# Setup
valid = lambda _, x: pd.Series([True]*5)
square = lambda _, x: pd.DataFrame({'col': x['col']**2})
valid = lambda _, x: pd.Series([True] * 5)
square = lambda _, x: pd.DataFrame({'col': x['col'] ** 2})
custom_constraint = create_custom_constraint(valid, sorted, square)('col')
data = pd.DataFrame({'col': [-10, 1, 0, 3, -.5]})

Expand Down
6 changes: 4 additions & 2 deletions tests/unit/tabular/test_copulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test___init__no_metadata(self):
field_transformers={'a_field': 'categorical'},
anonymize_fields={'a_field': 'name'},
primary_key=['a_field'],
constraints=[Inequality()],
constraints=[Inequality('col1', 'col2')],
field_distributions={'a_field': 'gaussian'},
default_distribution='beta',
categorical_transformer='categorical_fuzzy'
Expand All @@ -62,7 +62,9 @@ def test___init__no_metadata(self):
'fields': None,
'constraints': [
{
'constraint': 'sdv.constraints.tabular.Inequality'
'constraint': 'sdv.constraints.tabular.Inequality',
'high_column_name': 'col2',
'low_column_name': 'col1'
}
],
'model_kwargs': {
Expand Down

0 comments on commit 1d6cef1

Please sign in to comment.