Exemplo n.º 1
0
 def handle_message(self, msg_text, reply_target):
     try:
         print "Received: " + msg_text
         if gradeconvert.contains_grade(msg_text):
             self.reply(reply_target, gradeconvert.convert(msg_text))
         else:
             self.reply(reply_target, "I don't understand: " + msg_text)
     except StandardError as e:
         print "Error processing message: " + msg_text, e
         self.reply(reply_target, "I don't understand: " + msg_text)
Exemplo n.º 2
0
 def handle_message(self, msg_text, reply_target):
     try:
         print "Received: " + msg_text
         if gradeconvert.contains_grade(msg_text):
             self.reply(reply_target, gradeconvert.convert(msg_text))
         else:
             self.reply(reply_target, "I don't understand: " + msg_text)
     except StandardError as e:
         print "Error processing message: " + msg_text, e
         self.reply(reply_target, "I don't understand: " + msg_text)
Exemplo n.º 3
0
    def test_contains_grade(self):
        self.assertTrue(gradeconvert.contains_grade("One v grade v9"))
        self.assertTrue(gradeconvert.contains_grade("Two v grades V10 v9"))
        self.assertTrue(gradeconvert.contains_grade("One yos grade 5.12d"))
        self.assertTrue(gradeconvert.contains_grade("Two yos grades 5.9 5.15c"))
        self.assertTrue(gradeconvert.contains_grade("One font grade 6A"))
        self.assertTrue(gradeconvert.contains_grade("Two font grades 8C+ 4+"))
        self.assertTrue(gradeconvert.contains_grade("One french grade 5 a"))
        self.assertTrue(gradeconvert.contains_grade("Two french grades F6c+ 4+"))

        self.assertTrue(gradeconvert.contains_grade("Two mixed grades 5.12d 3"))
        self.assertTrue(gradeconvert.contains_grade("Two mixed grades V12 5C"))

        self.assertFalse(gradeconvert.contains_grade("No valid grade VB+"))
        self.assertFalse(gradeconvert.contains_grade("FJ+"))
Exemplo n.º 4
0
    def test_contains_grade(self):
        self.assertTrue(gradeconvert.contains_grade("One v grade v9"))
        self.assertTrue(gradeconvert.contains_grade("Two v grades V10 v9"))
        self.assertTrue(gradeconvert.contains_grade("One yos grade 5.12d"))
        self.assertTrue(
            gradeconvert.contains_grade("Two yos grades 5.9 5.15c"))
        self.assertTrue(gradeconvert.contains_grade("One font grade 6A"))
        self.assertTrue(gradeconvert.contains_grade("Two font grades 8C+ 4+"))
        self.assertTrue(gradeconvert.contains_grade("One french grade 5 a"))
        self.assertTrue(
            gradeconvert.contains_grade("Two french grades F6c+ 4+"))

        self.assertTrue(
            gradeconvert.contains_grade("Two mixed grades 5.12d 3"))
        self.assertTrue(gradeconvert.contains_grade("Two mixed grades V12 5C"))

        self.assertFalse(gradeconvert.contains_grade("No valid grade VB+"))
        self.assertFalse(gradeconvert.contains_grade("FJ+"))