示例#1
0
 def test_get_value_as_type_with_boolean(self):
     query = Query(field='metadata.is_public',
                   op='eq',
                   value='True',
                   type='boolean')
     expected = True
     self.assertEqual(query._get_value_as_type(), expected)
示例#2
0
 def test_get_value_as_type_with_integer(self):
     query = Query(field='metadata.size',
                   op='eq',
                   value='123',
                   type='integer')
     expected = 123
     self.assertEqual(query._get_value_as_type(), expected)
示例#3
0
 def test_get_value_as_type_with_string(self):
     query = Query(field='metadata.name',
                   op='eq',
                   value='linux',
                   type='string')
     expected = 'linux'
     self.assertEqual(query._get_value_as_type(), expected)
示例#4
0
 def test_get_value_as_type_with_integer(self):
     query = Query(field='metadata.size',
                   op='eq',
                   value='123',
                   type='integer')
     expected = 123
     self.assertEqual(query._get_value_as_type(), expected)
示例#5
0
 def test_get_value_as_type_boolean_expression_without_type(self):
     # bug 1221736
     query = Query(field='should_be_a_string',
                   op='eq',
                   value='True or False')
     expected = 'True or False'
     self.assertEqual(query._get_value_as_type(), expected)
示例#6
0
 def test_get_value_as_type_with_boolean(self):
     query = Query(field='metadata.is_public',
                   op='eq',
                   value='True',
                   type='boolean')
     expected = True
     self.assertEqual(query._get_value_as_type(), expected)
示例#7
0
 def test_get_value_as_type_with_string(self):
     query = Query(field='metadata.name',
                   op='eq',
                   value='linux',
                   type='string')
     expected = 'linux'
     self.assertEqual(query._get_value_as_type(), expected)
示例#8
0
 def test_get_value_as_type_boolean_expression_without_type(self):
     # bug 1221736
     query = Query(field='should_be_a_string',
                   op='eq',
                   value='True or False')
     expected = 'True or False'
     self.assertEqual(query._get_value_as_type(), expected)
示例#9
0
 def test_get_value_as_type_with_float(self):
     query = Query(field='metadata.size',
                   op='eq',
                   value='123.456',
                   type='float')
     expected = 123.456
     self.assertEqual(query._get_value_as_type(), expected)
示例#10
0
 def test_get_value_as_type_with_float(self):
     query = Query(field='metadata.size',
                   op='eq',
                   value='123.456',
                   type='float')
     expected = 123.456
     self.assertEqual(query._get_value_as_type(), expected)
示例#11
0
 def test_get_value_as_type_integer_expression_without_type(self):
     # bug 1221736
     query = Query(field='should_be_a_string',
                   op='eq',
                   value='123-1')
     expected = '123-1'
     self.assertEqual(query._get_value_as_type(), expected)
示例#12
0
 def test_get_value_as_type_with_syntax_error_colons(self):
     # bug 1221736
     value = 'Ref::StackId'
     query = Query(field='field_name',
                   op='eq',
                   value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
示例#13
0
 def test_get_value_as_type_with_syntax_error(self):
     # bug 1221736
     value = 'WWW-Layer-4a80714f-0232-4580-aa5e-81494d1a4147-uolhh25p5xxm'
     query = Query(field='group_id',
                   op='eq',
                   value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
示例#14
0
 def test_get_value_as_type_with_syntax_error_colons(self):
     # bug 1221736
     value = 'Ref::StackId'
     query = Query(field='field_name', op='eq', value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
示例#15
0
 def test_get_value_as_type_with_syntax_error(self):
     # bug 1221736
     value = 'WWW-Layer-4a80714f-0232-4580-aa5e-81494d1a4147-uolhh25p5xxm'
     query = Query(field='group_id', op='eq', value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
示例#16
0
 def test_get_value_as_type_with_string_without_type(self):
     query = Query(field="metadata.name", op="eq", value="linux")
     expected = "linux"
     self.assertEqual(query._get_value_as_type(), expected)
示例#17
0
 def test_get_value_as_type_with_syntax_error_colons(self):
     # bug 1221736
     value = "Ref::StackId"
     query = Query(field="field_name", op="eq", value=value)
     expected = value
     self.assertEqual(query._get_value_as_type(), expected)
示例#18
0
 def test_get_value_as_type_boolean_expression_without_type(self):
     # bug 1221736
     query = Query(field="should_be_a_string", op="eq", value="True or False")
     expected = "True or False"
     self.assertEqual(query._get_value_as_type(), expected)
示例#19
0
 def test_get_value_as_type_integer_expression_without_type(self):
     # bug 1221736
     query = Query(field="should_be_a_string", op="eq", value="123-1")
     expected = "123-1"
     self.assertEqual(query._get_value_as_type(), expected)
示例#20
0
 def test_get_value_as_type_with_float_without_type(self):
     query = Query(field="metadata.size", op="eq", value="123.456")
     expected = 123.456
     self.assertEqual(query._get_value_as_type(), expected)
示例#21
0
 def test_get_value_as_type_with_boolean_without_type(self):
     query = Query(field="metadata.is_public", op="eq", value="True")
     expected = True
     self.assertEqual(query._get_value_as_type(), expected)
示例#22
0
 def test_get_value_as_type_integer_expression_without_type(self):
     # bug 1221736
     query = Query(field='should_be_a_string', op='eq', value='123-1')
     expected = '123-1'
     self.assertEqual(query._get_value_as_type(), expected)
示例#23
0
 def test_get_value_as_type_with_integer(self):
     query = Query(field="metadata.size", op="eq", value="123", type="integer")
     expected = 123
     self.assertEqual(query._get_value_as_type(), expected)