Created
March 14, 2017 03:05
-
-
Save AndyLPK247/0292d0dccb035654a1aaf6e70b910d24 to your computer and use it in GitHub Desktop.
Python Testing 101 pytest Example: Math Function Tests (1)
This file contains 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
import pytest | |
from com.automationpanda.example.calc_func import * | |
NUMBER_1 = 3.0 | |
NUMBER_2 = 2.0 | |
def test_add(): | |
value = add(NUMBER_1, NUMBER_2) | |
assert value == 5.0 | |
def test_subtract(): | |
value = subtract(NUMBER_1, NUMBER_2) | |
assert value == 1.0 | |
def test_subtract_negative(): | |
value = subtract(NUMBER_2, NUMBER_1) | |
assert value == -1.0 | |
def test_multiply(): | |
value = multiply(NUMBER_1, NUMBER_2) | |
assert value == 6.0 | |
def test_divide(): | |
value = divide(NUMBER_1, NUMBER_2) | |
assert value == 1.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment