Example #1
0
 def test_validate_invalid_type(self):
     field = BytesField(name='asdf')
     with pytest.raises(ValueError):
         field._validate(MockConfig(), 100)
Example #2
0
 def test_validate_str(self):
     field = BytesField()
     field._validate(MockConfig(), 'hello') == b'hello'
Example #3
0
 def test_validate_bytes(self):
     field = BytesField()
     assert field._validate(None, b'hello') == b'hello'
Example #4
0
 def test_validate_str(self):
     field = BytesField()
     field._validate(None, 'hello') == b'hello'