コード例 #1
0
	def test_db_query(self):
		inp = parse("Sandy")
		quer = querify(inp,["id","name","kind"])
		self.assertEqual(str(Event.objects.filter(quer)),"[<Event: Hurricane Sandy>]")
コード例 #2
0
	def test_querify_1(self):
		inp = parse("\"Barack Obama\" US President")
		assert type(querify(inp, ["column1", "column2", "column3"])) is models.query_utils.Q
コード例 #3
0
	def test_querify_2(self):
		inp = parse("\"Barack Obama\" US Pres POTUS")
		self.assertEqual(len(querify(inp, ["column1", "column2", "column3"])),4) #len should be the number of things being parsed
コード例 #4
0
	def test_parse_5(self):
		out = parse("\"Barack Obama\" US President")
		assert type(out[0]) is str
		assert type(out[1]) is str
		assert type(out[2]) is str
コード例 #5
0
	def test_parse_4(self):
		out = parse("\"Barack Obama\" US President")
		self.assertEqual(len(out), 3)
コード例 #6
0
	def test_parse_3(self):
		out = parse("\"Barack Obama\" US President")
		assert type(out) is list
コード例 #7
0
	def test_parse_2(self):
		self.assertEqual(parse("\"Barack Obama\" US President")[0], "Barack Obama")
		self.assertEqual(parse("\"Barack Obama\" US President")[1], "US")
		self.assertEqual(parse("\"Barack Obama\" US President")[2], "President")
コード例 #8
0
	def test_parse_1(self):
		inp = "\"Barack Obama\" US President"
		out = parse(inp)
		self.assertEqual(out[0], "Barack Obama")
		self.assertEqual(out[1], "US")
		self.assertEqual(out[2], "President")