Esempio n. 1
0
 def pattern_for_negative_input_tests(self, given_answer, exception_type, exception_msg):
     with self.assertRaises(exception_type) as raised_exception:
         with patch('builtins.input', side_effect=given_answer), patch('sys.stdout', new=StringIO()) as fake_out:
             Functionality.triangle_defining()
     self.assertEqual(raised_exception.exception.args[0], exception_msg)
Esempio n. 2
0
 def pattern_for_positive_input_tests(self, given_answer, expected_out):
     with patch('builtins.input', side_effect=given_answer), patch('sys.stdout', new=StringIO()) as fake_out:
         Functionality.triangle_defining()
         self.assertEqual(fake_out.getvalue().strip(), expected_out)