Skip to content

Commit 15250b3

Browse files
committed
just checking in a test file for demo purposes.
1 parent c97a401 commit 15250b3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

testing/test_sample.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""Small sample tests for pytestdemo.
2+
3+
These are intentionally simple so running the single file should pass
4+
in any standard pytest environment.
5+
"""
6+
7+
import pytest
8+
9+
10+
def add(a, b):
11+
"""Simple helper used by the tests."""
12+
return a + b
13+
14+
15+
def test_add_positive_numbers():
16+
"""A basic happy-path test."""
17+
assert add(2, 3) == 5
18+
19+
20+
def test_add_with_zero():
21+
"""Edge case: adding zero should be identity."""
22+
assert add(0, 7) == 7
23+
24+
25+
def test_add_negative_numbers():
26+
"""Ensure negatives work as expected."""
27+
assert add(-2, -3) == -5
28+
29+
30+
@pytest.mark.parametrize("a,b,expected", [(1, 2, 3), (10, -1, 9), (0, 0, 0)])
31+
def test_add_parametrized(a, b, expected):
32+
assert add(a, b) == expected

0 commit comments

Comments
 (0)