Beispiel #1
0
 def test_can_build_a_complex_equality_query_using_disjunction3(self):
     query = q.eq('first_name', 'TestFirst')
     query |= q.eq('last_name', 'TestLast')
     self.assertIsInstance(query, DisjunctionQuery)
     self.assertTupleEqual(
         ("or", ("first_name", "eq", "TestFirst"), ("last_name", "eq", "TestLast")),
         query.to_tuple())
Beispiel #2
0
 def test_can_build_a_complex_equality_query_using_Negation3(self):
     query = q.eq('first_name', 'TestFirst')
     query = ~ query
     self.assertIsInstance(query, NegationQuery)
     self.assertTupleEqual(
         ("not", ("first_name", "eq", "TestFirst")),
         query.to_tuple())
Beispiel #3
0
 def test_can_build_a_simple_less_than_query2(self):
     query = q.lt("member_field:some_numeric_field", 5)
     self.assertIsInstance(query, op.LessThanQuery)
     self.assertTupleEqual(("member_field:some_numeric_field", "lt", 5), query.to_tuple())
Beispiel #4
0
 def test_can_build_a_simple_greater_than_query2(self):
     query = q.gt("member_field:some_numeric_field", 5)
     self.assertIsInstance(query, op.GreaterThanQuery)
     self.assertTupleEqual(("member_field:some_numeric_field", "gt", 5), query.to_tuple())
Beispiel #5
0
 def test_can_build_a_simple_contains_query2(self):
     query = q.zip_radius("member_field:some_zipcode_field", 10, 97202)
     self.assertIsInstance(query, op.ZipRadiusQuery)
     self.assertTupleEqual(("member_field:some_zipcode_field", "zip-radius:10", "97202"), query.to_tuple())
Beispiel #6
0
 def test_can_build_a_simple_contains_query3(self):
     with self.assertRaises(Exception):
         q.zip_radius("member_field:some_zipcode_field", 22, 97202)
Beispiel #7
0
 def test_can_build_a_simple_contains_query2(self):
     query = q.is_in("member_field:some_number_field", [3, 4, 5, 6])
     self.assertIsInstance(query, op.IsInQuery)
     self.assertTupleEqual(("member_field:some_number_field", "in", 3, 4, 5, 6), query.to_tuple())
Beispiel #8
0
 def test_can_build_a_simple_any_query2(self):
     query = q.any('member_field:some_array_field', 'ten')
     self.assertIsInstance(query, op.AnyQuery)
     self.assertTupleEqual(("member_field:some_array_field", "any", "ten"),
                           query.to_tuple())
Beispiel #9
0
 def test_can_build_a_simple_in_next_query2(self):
     query = q.in_next('member_since', {"day": 4})
     self.assertIsInstance(query, op.InNextQuery)
     self.assertTupleEqual(("member_since", "in next", {
         "day": 4
     }), query.to_tuple())
Beispiel #10
0
 def test_can_build_a_simple_datematch_query2(self):
     query = q.datematch("member_since", {"year": 2011})
     self.assertIsInstance(query, op.DateMatchQuery)
     self.assertTupleEqual(("member_since", "datematch", {"year": 2011}), query.to_tuple())
Beispiel #11
0
 def test_can_build_a_simple_greater_than_query2(self):
     query = q.gt('member_field:some_numeric_field', 5)
     self.assertIsInstance(query, op.GreaterThanQuery)
     self.assertTupleEqual(("member_field:some_numeric_field", "gt", 5),
                           query.to_tuple())
Beispiel #12
0
 def test_can_build_a_simple_between_query2(self):
     query = q.between('member_field:some_numeric_field', 5, 10)
     self.assertIsInstance(query, op.BetweenQuery)
     self.assertTupleEqual(
         ("member_field:some_numeric_field", "between", 5, 10),
         query.to_tuple())
Beispiel #13
0
 def test_can_build_a_simple_less_than_query2(self):
     query = q.lt('member_field:some_numeric_field', 5)
     self.assertIsInstance(query, op.LessThanQuery)
     self.assertTupleEqual(("member_field:some_numeric_field", "lt", 5),
                           query.to_tuple())
Beispiel #14
0
 def test_can_build_a_simple_contains_query3(self):
     with self.assertRaises(Exception):
         q.zip_radius('member_field:some_zipcode_field', 22, 97202)
Beispiel #15
0
 def test_can_build_a_simple_contains_query2(self):
     query = q.zip_radius('member_field:some_zipcode_field', 10, 97202)
     self.assertIsInstance(query, op.ZipRadiusQuery)
     self.assertTupleEqual(
         ("member_field:some_zipcode_field", "zip-radius:10", "97202"),
         query.to_tuple())
Beispiel #16
0
 def test_can_build_a_simple_between_query2(self):
     query = q.between("member_field:some_numeric_field", 5, 10)
     self.assertIsInstance(query, op.BetweenQuery)
     self.assertTupleEqual(("member_field:some_numeric_field", "between", 5, 10), query.to_tuple())
Beispiel #17
0
 def test_can_build_a_simple_datematch_query2(self):
     query = q.datematch('member_since', {"year": 2011})
     self.assertIsInstance(query, op.DateMatchQuery)
     self.assertTupleEqual(("member_since", "datematch", {
         "year": 2011
     }), query.to_tuple())
Beispiel #18
0
 def test_can_build_a_simple_in_next_query2(self):
     query = q.in_next("member_since", {"day": 4})
     self.assertIsInstance(query, op.InNextQuery)
     self.assertTupleEqual(("member_since", "in next", {"day": 4}), query.to_tuple())
Beispiel #19
0
 def test_can_build_a_complex_equality_query_using_conjunction(self):
     query = q.eq('first_name', 'TestFirst').conjoin(q.eq('last_name', 'TestLast'))
     self.assertIsInstance(query, ConjunctionQuery)
     self.assertTupleEqual(
         ("and", ("first_name", "eq", "TestFirst"), ("last_name", "eq", "TestLast")),
         query.to_tuple())
Beispiel #20
0
 def test_can_build_a_simple_contains_query2(self):
     query = q.contains("member_field:some_string_field", "*foo*")
     self.assertIsInstance(query, op.ContainsQuery)
     self.assertTupleEqual(("member_field:some_string_field", "contains", "*foo*"), query.to_tuple())
Beispiel #21
0
 def test_can_build_a_simple_contains_query2(self):
     query = q.contains('member_field:some_string_field', '*foo*')
     self.assertIsInstance(query, op.ContainsQuery)
     self.assertTupleEqual(
         ("member_field:some_string_field", "contains", "*foo*"),
         query.to_tuple())
Beispiel #22
0
 def test_can_build_a_simple_equality_query2(self):
     query = q.eq("first_name", "Test")
     self.assertIsInstance(query, op.EqualityQuery)
     self.assertTupleEqual(("first_name", "eq", "Test"), query.to_tuple())
Beispiel #23
0
 def test_can_build_a_simple_contains_query2(self):
     query = q.is_in('member_field:some_number_field', [3, 4, 5, 6])
     self.assertIsInstance(query, op.IsInQuery)
     self.assertTupleEqual(
         ("member_field:some_number_field", "in", 3, 4, 5, 6),
         query.to_tuple())
Beispiel #24
0
 def test_can_build_a_simple_any_query2(self):
     query = q.any("member_field:some_array_field", "ten")
     self.assertIsInstance(query, op.AnyQuery)
     self.assertTupleEqual(("member_field:some_array_field", "any", "ten"), query.to_tuple())
Beispiel #25
0
 def test_can_build_a_simple_equality_query2(self):
     query = q.eq('first_name', 'Test')
     self.assertIsInstance(query, op.EqualityQuery)
     self.assertTupleEqual(("first_name", "eq", "Test"), query.to_tuple())