Example #1
0
 def test_no_association_when_accuracy_requirement_increased(self):
     associator = MessageDisasterAssociator(
         'NECOC.KATAKWI floads have invaded')
     self.assertEqual(None, associator.match_disaster())
Example #2
0
 def test_associated_even_when_disaster_is_merely_implied(self):
     associator = MessageDisasterAssociator(
         'NECOC.KATAKWI it has been raining heavily lately with cloudy skys all day'
     )
     self.assertEqual("Flood", associator.match_disaster())
Example #3
0
 def test_no_association_when_no_match_found(self):
     associator = MessageDisasterAssociator(
         'NECOC.KATAKWI locusts have invaded')
     self.assertEqual(None, associator.match_disaster())
Example #4
0
 def test_associated_if_text_matched_reasonably(self):
     associator = MessageDisasterAssociator(
         'NECOC.KATAKWI floads have invaded')
     self.assertEqual("Flood", associator.match_disaster())
Example #5
0
 def test_associated_if_text_matched_accurately(self):
     associator = MessageDisasterAssociator(self.text)
     self.assertEqual("Fire", associator.match_disaster())
Example #6
0
    def test_no_disaster_is_mached_when_no_text_given(self):
        associator = MessageDisasterAssociator(None)
        self.assertEqual(None, associator.match_disaster())

        associator = MessageDisasterAssociator('')
        self.assertEqual(None, associator.match_disaster())
Example #7
0
 def _associate_to_disaster(self):
     return MessageDisasterAssociator(self.text).match_disaster()