示例#1
0
    def test_serialization(self, constraint: Constraint):
        """Test that serialization and deserialization of ``Constraint`` objects work correctly."""
        expected_constraint = constraint
        constraint_pb = constraint.to_pb()
        actual_constraint = Constraint.from_pb(constraint_pb)

        assert expected_constraint == actual_constraint
示例#2
0
 def test_raise_exception_when_not_supported_constrainttype(self):
     with pytest.raises(ValueError,
                        match="The constraint type is not valid"):
         a_constraint = Constraint("foo", tuple())
         a_constraint.to_pb()