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