Created
October 19, 2019 15:49
-
-
Save Createdd/1d826afcac163bb75a295f85c1a8c231 to your computer and use it in GitHub Desktop.
unit tests for the calculator exercise of programming class
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
| def test_addtion_int(): | |
| assert calculate_result(2, 3, 'int', "addition") == 5 | |
| def test_addtion_float(): | |
| assert calculate_result(2.1, 3.5, 'float', "addition") == 5.6 | |
| def test_subtraction_int(): | |
| assert calculate_result(4, 3, 'int', "subtraction") == 1 | |
| def test_subtraction_float(): | |
| assert calculate_result(4.5, 3.2, 'float', "subtraction") == 1.2999999999999998 | |
| def test_multiplication_int(): | |
| assert calculate_result(2, 3, 'int', "multiplication") == 6 | |
| def test_multiplication_float(): | |
| assert calculate_result(2.1, 3.5, 'float', "multiplication") == 7.3500000000000005 | |
| def test_division_int(): | |
| assert calculate_result(9, 3, 'int', "division") == 3 | |
| def test_division_float(): | |
| assert calculate_result(9.1, 3.5, 'float', "division") == 2.6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment