Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from calculator import Calculator
- class TddInPythonExample(unittest.TestCase):
- def test_calculator_add_method_returns_correct_result(self):
- calc = Calculator()
- result = calc.add(2, 2)
- self.assertEqual(4, result)
- def test_calculator_returns_error_message_if_both_args_not_numbers(self):
- self.assertRaises(ValueError, self.calc.add, 'two', 'three')
- Traceback (most recent call last):
- File "C:Python27libsite-packagesnose-1.3.1-py2.7.eggnoseloader.py", line 411, in loadTestsFromNa
- addr.filename, addr.module)
- File "C:Python27libsite-packagesnose-1.3.1-py2.7.eggnoseimporter.py", line 47, in importFromPath
- return self.importFromDir(dir_path, fqname)
- File "C:Python27libsite-packagesnose-1.3.1-py2.7.eggnoseimporter.py", line 94, in importFromDir
- mod = load_module(part_fqname, fh, filename, desc)
- File "C:Devthinkcalculator_tests.py", line 10
- self.assertRaises(ValueError, self.calc.add, 'two', 'three')
- ^
- IndentationError: expected an indented block
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement