Пример #1
0
 def test_casts_complex_query_values_to_boolean(self):
     qp = BooleanIndexQueryParser()
     self.assertEqual({'query': True}, qp.parse({'query': 'True'}))
     self.assertEqual({'query': True}, qp.parse({'query': 'true'}))
     self.assertEqual({'query': True}, qp.parse({'query': '1'}))
     self.assertEqual({'query': False}, qp.parse({'query': 'False'}))
     self.assertEqual({'query': False}, qp.parse({'query': 'false'}))
     self.assertEqual({'query': False}, qp.parse({'query': '0'}))
Пример #2
0
 def test_casts_simple_query_to_boolean(self):
     qp = BooleanIndexQueryParser()
     self.assertEqual(True, qp.parse('True'))
     self.assertEqual(True, qp.parse('true'))
     self.assertEqual(True, qp.parse('1'))
     self.assertEqual(False, qp.parse('False'))
     self.assertEqual(False, qp.parse('false'))
     self.assertEqual(False, qp.parse('0'))
Пример #3
0
 def test_casts_complex_query_values_to_boolean(self):
     qp = BooleanIndexQueryParser()
     self.assertEqual({"query": True}, qp.parse({"query": "True"}))
     self.assertEqual({"query": True}, qp.parse({"query": "true"}))
     self.assertEqual({"query": True}, qp.parse({"query": "1"}))
     self.assertEqual({"query": False}, qp.parse({"query": "False"}))
     self.assertEqual({"query": False}, qp.parse({"query": "false"}))
     self.assertEqual({"query": False}, qp.parse({"query": "0"}))
Пример #4
0
 def test_casts_simple_query_to_boolean(self):
     qp = BooleanIndexQueryParser()
     self.assertEqual(True, qp.parse("True"))
     self.assertEqual(True, qp.parse("true"))
     self.assertEqual(True, qp.parse("1"))
     self.assertEqual(False, qp.parse("False"))
     self.assertEqual(False, qp.parse("false"))
     self.assertEqual(False, qp.parse("0"))
Пример #5
0
 def test_casts_complex_query_values_to_boolean(self):
     qp = BooleanIndexQueryParser()
     self.assertEqual({'query': True}, qp.parse({'query': 'True'}))
     self.assertEqual({'query': True}, qp.parse({'query': 'true'}))
     self.assertEqual({'query': True}, qp.parse({'query': '1'}))
     self.assertEqual({'query': False}, qp.parse({'query': 'False'}))
     self.assertEqual({'query': False}, qp.parse({'query': 'false'}))
     self.assertEqual({'query': False}, qp.parse({'query': '0'}))
Пример #6
0
 def test_casts_simple_query_to_boolean(self):
     qp = BooleanIndexQueryParser()
     self.assertEqual(True, qp.parse('True'))
     self.assertEqual(True, qp.parse('true'))
     self.assertEqual(True, qp.parse('1'))
     self.assertEqual(False, qp.parse('False'))
     self.assertEqual(False, qp.parse('false'))
     self.assertEqual(False, qp.parse('0'))
Пример #7
0
 def test_raises_for_invalid_query_type(self):
     qp = BooleanIndexQueryParser()
     with self.assertRaises(QueryParsingError):
         qp.parse(42)
Пример #8
0
 def test_raises_for_invalid_query_type(self):
     qp = BooleanIndexQueryParser()
     with self.assertRaises(QueryParsingException):
         qp.parse(42)