Пример #1
0
 def test_convert(self):
     #Success cases
     self.assertEquals("F6c is 5.11a/b, font 6C is V5", gradeconvert.convert("6c"))
     self.assertEquals("F8c+ is 5.14c, V9 is font 7C", gradeconvert.convert("What is F8c+? and V9"))
     self.assertEquals("F8c+ is 5.14c, font 8C+ is V16, V9 is font 7C", gradeconvert.convert("What is 8c+? and v9?"))
     self.assertEquals("V12 is font 8A+, font 8A is V11", gradeconvert.convert("Why is SSD V12 but PI font 8A?"))
     self.assertEquals("F8a is 5.13b, font 8A is V11, F8b+ is 5.14a, font 8B+ is V14", gradeconvert.convert("8A8b+"))
Пример #2
0
 def test_convert(self):
     #Success cases
     self.assertEquals("F6c is 5.11a/b, font 6C is V5",
                       gradeconvert.convert("6c"))
     self.assertEquals("F8c+ is 5.14c, V9 is font 7C",
                       gradeconvert.convert("What is F8c+? and V9"))
     self.assertEquals("F8c+ is 5.14c, font 8C+ is V16, V9 is font 7C",
                       gradeconvert.convert("What is 8c+? and v9?"))
     self.assertEquals(
         "V12 is font 8A+, font 8A is V11",
         gradeconvert.convert("Why is SSD V12 but PI font 8A?"))
     self.assertEquals(
         "F8a is 5.13b, font 8A is V11, F8b+ is 5.14a, font 8B+ is V14",
         gradeconvert.convert("8A8b+"))
Пример #3
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)
Пример #4
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)