示例#1
0
 def test_ask_open_door(self):
     obj = Interface()
     question = 'Open the door hal'
     result = obj.demand(question)
     output_to_file(question, result)
     self.assertEqual(result,
                      'I\'m afraid I can\'t do that ' + getpass.getuser())
示例#2
0
 def test_random_number_range_greater(self):
     obj = Interface()
     question = 'Give me a number between 1 and 6'
     result = obj.demand(question)
     output_to_file(question, result)
     self.assertGreaterEqual(result, 1)
示例#3
0
 def test_random_number_range_invalid(self):
     obj = Interface()
     question = 'Give me a number between 10 and 10'
     result = obj.demand(question)
     output_to_file(question, result)
     self.assertLessEqual(result, "Invalid range")
示例#4
0
 def test_ask_open_door(self):
     obj = Interface()
     question = 'Open the door hal'
     result = obj.demand(question)
     output_to_file(question, result)
     self.assertEqual(result, 'I\'m afraid I can\'t do that ' + getpass.getuser())
示例#5
0
 def test_random_number_range_invalid(self):
     obj = Interface()
     question = 'Give me a number between 10 and 10'
     result = obj.demand(question)
     output_to_file(question, result)
     self.assertLessEqual(result, "Invalid range")
示例#6
0
 def test_random_number_range_greater(self):
     obj = Interface()
     question  = 'Give me a number between 1 and 6'
     result = obj.demand(question)
     output_to_file(question, result)
     self.assertGreaterEqual(result, 1)
示例#7
0
 def test_demand_unknown(self):
     obj = Interface()
     result = obj.demand('Give me a soda')
     self.assertEqual(result, 'I don\'t know how to do that')
示例#8
0
 def test_demand_invalid_string(self):
     obj = Interface()
     result = obj.demand(2)
     self.assertEqual(result, 'Not A String!')