Skip to content

Commit

Permalink
Remove all references to Constraint.from_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
fealho committed Jun 23, 2022
1 parent 76627fe commit fdff66a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 60 deletions.
1 change: 0 additions & 1 deletion docs/api_reference/constraints/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ Constraint
Constraint.reverse_transform
Constraint.is_valid
Constraint.filter_valid
Constraint.from_dict
Constraint.to_dict
10 changes: 0 additions & 10 deletions docs/api_reference/constraints/tabular.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ CustomConstraint
CustomConstraint.reverse_transform
CustomConstraint.is_valid
CustomConstraint.filter_valid
CustomConstraint.from_dict
CustomConstraint.to_dict

FixedCombinations
Expand All @@ -34,7 +33,6 @@ FixedCombinations
FixedCombinations.reverse_transform
FixedCombinations.is_valid
FixedCombinations.filter_valid
FixedCombinations.from_dict
FixedCombinations.to_dict

Inequality
Expand All @@ -50,7 +48,6 @@ Inequality
Inequality.reverse_transform
Inequality.is_valid
Inequality.filter_valid
Inequality.from_dict
Inequality.to_dict

ScalarInequality
Expand All @@ -66,7 +63,6 @@ ScalarInequality
ScalarInequality.reverse_transform
ScalarInequality.is_valid
ScalarInequality.filter_valid
ScalarInequality.from_dict
ScalarInequality.to_dict

Positive
Expand All @@ -82,7 +78,6 @@ Positive
Positive.reverse_transform
Positive.is_valid
Positive.filter_valid
Positive.from_dict
Positive.to_dict

Negative
Expand All @@ -98,7 +93,6 @@ Negative
Negative.reverse_transform
Negative.is_valid
Negative.filter_valid
Negative.from_dict
Negative.to_dict

Range
Expand All @@ -114,7 +108,6 @@ Range
Range.reverse_transform
Range.is_valid
Range.filter_valid
Range.from_dict
Range.to_dict

ScalarRange
Expand All @@ -130,7 +123,6 @@ ScalarRange
ScalarRange.reverse_transform
ScalarRange.is_valid
ScalarRange.filter_valid
ScalarRange.from_dict
ScalarRange.to_dict

OneHotEncoding
Expand All @@ -146,7 +138,6 @@ OneHotEncoding
OneHotEncoding.reverse_transform
OneHotEncoding.is_valid
OneHotEncoding.filter_valid
OneHotEncoding.from_dict
OneHotEncoding.to_dict

Unique
Expand All @@ -162,5 +153,4 @@ Unique
Unique.reverse_transform
Unique.is_valid
Unique.filter_valid
Unique.from_dict
Unique.to_dict
1 change: 0 additions & 1 deletion docs/developer_guides/sdv/constraints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ The following public methods are implemented in this class:
* ``is_valid``: Return a ``pandas.Series`` full or ``True`` values with the same length as the
given data.
* ``filter_valid``: Return only the rows for which ``self.is_valid`` returns ``True``.
* ``from_dict``: Build a ``Constraint`` from its dict representation.
* ``to_dict``: Return a dict representing the ``Constraint``.

Implementing a Custom Constraint
Expand Down
48 changes: 0 additions & 48 deletions tests/unit/constraints/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,54 +536,6 @@ def test_filter_valid_with_invalid_index(self):
})
pd.testing.assert_frame_equal(expected_out, out)

def test_from_dict_fqn(self):
"""Test the ``Constraint.from_dict`` method passing a FQN.
If the ``constraint`` string is a FQN, import the class
before creating an instance of it.
Input:
- constraint dict with a FQN and args
Output:
- Instance of the subclass with the right args.
"""
# Setup
constraint_dict = {
'constraint': 'sdv.constraints.tabular.FixedCombinations',
'column_names': ['a', 'b'],
}

# Run
instance = Constraint.from_dict(constraint_dict)

# Assert
assert isinstance(instance, FixedCombinations)
assert instance._columns == ['a', 'b']

def test_from_dict_subclass(self):
"""Test the ``Constraint.from_dict`` method passing a subclass name.
If the ``constraint`` string is a subclass name, take it from the
Subclasses dict.
Input:
- constraint dict with a subclass name and args
Output:
- Instance of the subclass with the right args.
"""
# Setup
constraint_dict = {
'constraint': 'FixedCombinations',
'column_names': ['a', 'b'],
}

# Run
instance = Constraint.from_dict(constraint_dict)

# Assert
assert isinstance(instance, FixedCombinations)
assert instance._columns == ['a', 'b']

def test_to_dict(self):
"""Test the ``Constraint.to_dict`` method.
Expand Down

0 comments on commit fdff66a

Please sign in to comment.