Skip to content

Commit b2d14cc

Browse files
committed
Add doctest output GH-47
1 parent cee6f70 commit b2d14cc

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

lectures/12_clean_code.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,10 @@ def fizzbuzz(i: int) -> str:
10361036

10371037
## doctest
10381038

1039+
:::::::::::: {.columns}
1040+
::::::::: {.column width="50%"}
10391041
::: {.pre-475}
1042+
10401043
```python
10411044
def fizzbuzz(i: int) -> str:
10421045
"""
@@ -1062,8 +1065,41 @@ def fizzbuzz(i: int) -> str:
10621065
result = str(i)
10631066
return result
10641067
```
1068+
10651069
:::
10661070

1071+
:::::::::
1072+
::::::::: {.column width="50%" .fragment}
1073+
::: {.pre-475}
1074+
``` {.python}
1075+
python -m doctest -v fizzbuzz_doctest.py
1076+
Trying:
1077+
fizzbuzz(3)
1078+
Expecting:
1079+
'Fizz'
1080+
ok
1081+
Trying:
1082+
fizzbuzz(5)
1083+
Expecting:
1084+
'Buzz'
1085+
ok
1086+
Trying:
1087+
fizzbuzz(15)
1088+
Expecting:
1089+
'FizzBuzz'
1090+
ok
1091+
Trying:
1092+
fizzbuzz(17)
1093+
Expecting:
1094+
'17'
1095+
ok
1096+
4 passed.
1097+
Test passed.
1098+
```
1099+
1100+
:::
1101+
:::::::::
1102+
::::::::::::
10671103

10681104
# references
10691105

0 commit comments

Comments
 (0)