forked from marimo-team/marimo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunning_doctests.py
More file actions
48 lines (37 loc) · 904 Bytes
/
Copy pathrunning_doctests.py
File metadata and controls
48 lines (37 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import marimo
__generated_with = "0.10.6"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _():
def euclid_mcd(a: int, b: int) -> int:
"""Return the MCD between positive a, b.
>>> euclid_mcd(42, 24)
6
>>> euclid_mcd(24, 42)
6
>>> euclid_mcd(42, 42)
42
"""
assert a > 0
assert b > 0
if a < b:
a, b = b, a
if (a != b):
r = a - b
return euclid_mcd(b, r)
return a
return (euclid_mcd,)
@app.cell
def _(euclid_mcd, mo):
# Include a reference to each function to test
euclid_mcd
import doctest
failures, success = doctest.testmod(verbose=True)
mo.md(f"Success: {success}, Failures: {failures}")
return doctest, failures, success
if __name__ == "__main__":
app.run()