Пример #1
0
 def test_validate_bad_max_length_fail(self):
     with pytest.raises(exceptions.InfluxDBAttributeValueError):
         attr = attributes.StringFieldAttribute(max_length=5)
         attr.set_internal_value('test_value')
Пример #2
0
 def test_validate_invalid_negative_max_length_fail(self):
     with pytest.raises(exceptions.InfluxDBAttributeValueError):
         attributes.StringFieldAttribute(max_length=-7)
Пример #3
0
 def test_validate_bad_choice_type_fail(self):
     with pytest.raises(exceptions.InfluxDBAttributeValueError):
         attr = attributes.StringFieldAttribute(choices=['first', 'last'])
         attr.set_internal_value('ok')
Пример #4
0
 def test_validate_invalid_choices_item_type_fail(self):
     with pytest.raises(exceptions.InfluxDBAttributeValueError):
         attributes.StringFieldAttribute(choices=[5, 2, 3])
Пример #5
0
 def test_to_influx_success(self):
     attr = attributes.StringFieldAttribute()
     assert attr.to_influx('5') == "\'5\'"
Пример #6
0
 def test_to_python_success(self):
     attr = attributes.StringFieldAttribute()
     assert attr.to_python(5) == '5'