Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. from calculator import Calculator
  2.  
  3. class TddInPythonExample(unittest.TestCase):
  4. def test_calculator_add_method_returns_correct_result(self):
  5. calc = Calculator()
  6. result = calc.add(2, 2)
  7. self.assertEqual(4, result)
  8.  
  9. def test_calculator_returns_error_message_if_both_args_not_numbers(self):
  10. self.assertRaises(ValueError, self.calc.add, 'two', 'three')
  11.  
  12. Traceback (most recent call last):
  13. File "C:Python27libsite-packagesnose-1.3.1-py2.7.eggnoseloader.py", line 411, in loadTestsFromNa
  14. addr.filename, addr.module)
  15. File "C:Python27libsite-packagesnose-1.3.1-py2.7.eggnoseimporter.py", line 47, in importFromPath
  16. return self.importFromDir(dir_path, fqname)
  17. File "C:Python27libsite-packagesnose-1.3.1-py2.7.eggnoseimporter.py", line 94, in importFromDir
  18. mod = load_module(part_fqname, fh, filename, desc)
  19. File "C:Devthinkcalculator_tests.py", line 10
  20. self.assertRaises(ValueError, self.calc.add, 'two', 'three')
  21. ^
  22. IndentationError: expected an indented block
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement