Skip to content

Commit 6fc51de

Browse files
add test example
1 parent 033a3f3 commit 6fc51de

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import marimo
2+
3+
__generated_with = "0.13.6"
4+
app = marimo.App(width="medium")
5+
6+
7+
@app.cell
8+
def _():
9+
import pytest
10+
11+
return (pytest,)
12+
13+
14+
@app.function
15+
def add_numbers(a, b):
16+
"""Return the sum of two numbers."""
17+
return a + b
18+
19+
20+
@app.function
21+
def test_add_numbers():
22+
assert add_numbers(2, 3) == 5
23+
24+
25+
@app.cell
26+
def _(pytest):
27+
@pytest.mark.parametrize(
28+
"a, b, expected",
29+
[
30+
(2, 3, 5),
31+
(-1, 1, 0),
32+
(0, 0, 0),
33+
],
34+
)
35+
def test_multiple_add_numbers(a, b, expected):
36+
assert add_numbers(a, b) == expected
37+
38+
return
39+
40+
41+
if __name__ == "__main__":
42+
app.run()

0 commit comments

Comments
 (0)