What is PyTest Framework?

HOME

pip install pytest

def test_addition():
    a = 6
    b = 5
    c = 11

    assert a + b == 11, "Sum is not 11"
    assert a + b == c, "Sum of a and b is not equal to c"


def test_subtraction():
    x = 15
    y = 4
    z = 18

    assert x - y == z, "Subtract y from x is equal to z"

pytest

test_sample - valid
sample_test - valid
sample_tests - invalid
testsample - invalid
sampletest - invalid

Leave a comment