Ejemplo n.º 1
0
 def test_parsing_a_reply_with_invalid_question(self):
     f = open("test/test_parsing_a_reply_with_invalid_question.eml")
     try:
         messaging.parse_reply(f)
     except messaging.IncorrectReply:
         pass
     else:
         assert False, "messaging.IncorrectReply wasn't thrown"
Ejemplo n.º 2
0
	def test_parsing_a_reply_with_invalid_question(self):
		f = open("test/test_parsing_a_reply_with_invalid_question.eml")
		try:
			messaging.parse_reply(f)
		except messaging.IncorrectReply:
			pass
		else:
			assert False, "messaging.IncorrectReply wasn't thrown"
Ejemplo n.º 3
0
	def test_parsing_a_tiny_reply(self):
		f = open("test/test_parsing_a_tiny_reply.eml")
		messaging.parse_reply(f)
		questions = Question.find(test_id=2)
		base_conds = [Question.pair_id == Pair.id]
		conds_norm = base_conds + [Question.inverted == False,
				Pair.first_phrase_id == Phrase.id]
		conds_inv = base_conds + [Question.inverted == True,
				Pair.second_phrase_id == Phrase.id]
		assert questions.find(*conds_norm +
				[Phrase.value==u'cebula']).one().result == True
		assert questions.find(*conds_norm +
				[Phrase.value==u'wąż']).one().result == False
		assert questions.find(*conds_inv +
				[Phrase.value==u'cebolla']).one().result == False
		assert questions.find(*conds_inv +
				[Phrase.value==u'serpiente']).one().result == True
Ejemplo n.º 4
0
 def test_parsing_a_tiny_reply(self):
     f = open("test/test_parsing_a_tiny_reply.eml")
     messaging.parse_reply(f)
     questions = Question.find(test_id=2)
     base_conds = [Question.pair_id == Pair.id]
     conds_norm = base_conds + [
         Question.inverted == False, Pair.first_phrase_id == Phrase.id
     ]
     conds_inv = base_conds + [
         Question.inverted == True, Pair.second_phrase_id == Phrase.id
     ]
     assert questions.find(*conds_norm +
                           [Phrase.value == u'cebula']).one().result == True
     assert questions.find(*conds_norm +
                           [Phrase.value == u'wąż']).one().result == False
     assert questions.find(
         *conds_inv + [Phrase.value == u'cebolla']).one().result == False
     assert questions.find(
         *conds_inv + [Phrase.value == u'serpiente']).one().result == True