Skip to content
Snippets Groups Projects
Commit 4c99a46a authored by Muhamed's avatar Muhamed
Browse files

multiple negative numbers and \n

parent eaff9c27
Branches Feature-3 Feature-4
No related tags found
No related merge requests found
......@@ -61,6 +61,17 @@ class TestStingCalculator(unittest.TestCase):
with self.assertRaises(ValueError) as e:
self.calculator.add("-1,2")
self.assertEqual(str(e.exception), "negatives not allowed: -1")
def test_multiple_negative_numbers_exception(self):
with self.assertRaises(ValueError)as e:
self.calculator.add("-1,-2,3")
self.assertEqual(str(e.exception),"negatives not allowed: -1,-2")
with self.assertRaises(ValueError) as e:
self.calculator.add("-1,-3,4")
self.assertEqual(str(e.exception),"negatives not allowed: -1,-3")
with self.assertRaises(ValueError) as e:
self.calculator.add("-1\n-3,4")
self.assertEqual(str(e.exception),"negatives not allowed: -1,-3")
if __name__=='__main__':
unittest.main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment