コード例 #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'