Esempio n. 1
0
 def test_that_it_returns_a_valid_number(self):
     mock = MockUserInput([3])
     validator = InputValidator(mock)
     self.assertEqual(3,validator.validate((1,2,3)))
Esempio n. 2
0
 def test_that_it_returns_different_types(self):
     valid_responses = ["a","b"]
     input_source = MockUserInput(["c","d","b"])
     validator = InputValidator(input_source)
     self.assertEqual("b",validator.validate(valid_responses,str))
Esempio n. 3
0
 def test_that_it_works_with_str_nums(self):
     valid_responses = (3,4)
     input_source = MockUserInput("3")
     validator = InputValidator(input_source)
     self.assertEqual(3,validator.validate(valid_responses))
Esempio n. 4
0
 def test_that_it_works_through_different_types(self):
     valid_response = [7]
     input_source = MockUserInput(["a","b","7"])
     validator = InputValidator(input_source)
     self.assertEqual(7,validator.validate(valid_response))
Esempio n. 5
0
 def test_that_it_returns_a_number_in_valid_response(self):
     valid_responses = [3,4,5]
     mock = MockUserInput((1,4))
     validator = InputValidator(mock)
     self.assertEqual(4,validator.validate(valid_responses))