Esempio n. 1
0
 def test_to_representation_invalid(self, value):
     field = StringListBooleanField()
     with pytest.raises(ValidationError) as e:
         field.to_representation(value)
     assert e.value.detail[
         0] == "Expected None, True, False, a string or list " "of strings but got {} instead.".format(
             type(value))
Esempio n. 2
0
 def test_to_representation_valid(self, value_in, value_known):
     field = StringListBooleanField()
     v = field.to_representation(value_in)
     assert v == value_known
Esempio n. 3
0
 def test_to_internal_value_valid(self, value_in, value_known):
     field = StringListBooleanField()
     v = field.to_internal_value(value_in)
     assert v == value_known