Ejemplo n.º 1
0
 def prompt_and_collect_input(self, ordered_prompt_hash):
     for prompt in ordered_prompt_hash.keys():
         self.display_object.display(prompt)
         answer = InputValidator.return_valid_response(
             self.input_object, ordered_prompt_hash[prompt])
         self.answers.append(answer)
         self.prompt_hash[prompt] = answer
Ejemplo n.º 2
0
 def prompt_and_collect_input(self,ordered_prompt_hash):
     for prompt in ordered_prompt_hash.keys():
         self.display_object.display(prompt)
         answer = InputValidator.return_valid_response(self.input_object,ordered_prompt_hash[prompt])
         self.answers.append(answer)
         self.prompt_hash[prompt] = answer
Ejemplo n.º 3
0
 def test_that_it_returns_a_valid_number(self):
     mock = MockUserInput([3])
     validator = InputValidator(mock)
     self.assertEqual(3,validator.validate((1,2,3)))
Ejemplo n.º 4
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))
Ejemplo n.º 5
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))
Ejemplo n.º 6
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))
Ejemplo n.º 7
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))