Skip to content

Commit

Permalink
Test states
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadelmalah committed May 7, 2024
1 parent 7f48398 commit 89ba71f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions testing/test_states.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import pytest
from sum import sum


def test_pass():
assert sum(1, 2) == 3


def test_fail():
assert sum(1, 2) == 4


# Xfailed
@pytest.mark.xfail()
def test_sum_negative():
assert sum(1, 2) == 4


@pytest.mark.xfail()
def test_sum_negative_raise():
raise Exception("This test is expected to fail")


# XPassed
@pytest.mark.xfail()
def test_sum_positive():
assert sum(1, 2) == 3


# Skipped
@pytest.mark.skip(reason="Do not run this test")
def test_sum_skip():
assert sum(1, 2) == 3

0 comments on commit 89ba71f

Please sign in to comment.