Skip to content

Instantly share code, notes, and snippets.

@AndyLPK247
Created March 14, 2017 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AndyLPK247/0292d0dccb035654a1aaf6e70b910d24 to your computer and use it in GitHub Desktop.
Save AndyLPK247/0292d0dccb035654a1aaf6e70b910d24 to your computer and use it in GitHub Desktop.
Python Testing 101 pytest Example: Math Function Tests (1)
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