Created
November 3, 2019 05:26
-
-
Save afaqk9394/b3e04b4d6d4a669753acfa723c4cd212 to your computer and use it in GitHub Desktop.
calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Calculator(object): | |
| def subtract(self, x, y): | |
| pass | |
| test_calc.py | |
| import unittest # importing standard unittest module from python library | |
| from testapp.calculator import Calculator # import | |
| class TddPython(unittest.TestCase): # our class that would contain multiple test cases | |
| def test_calc_subtract_method(self): # test method | |
| calc = Calculator() # initiliate the Calculator | |
| result = calc.subtract(4,1) | |
| self.assertEqual(3, result) | |
| if __name__ == '__main__': | |
| unittest.main() # execute test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment