FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python_reference/doctest_example.py at master · wavelets/python_reference · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
wavelets
/
python_reference
Public
forked from
rasbt/python_reference
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python_reference
/
doctest_example.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (39 loc) · 961 Bytes
Breadcrumbs
python_reference
/
doctest_example.py
Copy path
File metadata and controls
47 lines (39 loc) · 961 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# doctest example
# Sebastian Raschka 11/19/2013
def
subtract
(
a
,
b
):
"""
Subtracts second from first number and returns result.
>>> subtract(10, 5)
5
>>> subtract(11, 0.7)
10.3
"""
return
a
-
b
def
hello_world
():
"""
Returns 'Hello, World'
>>> hello_world()
"Hello, World"
>>> hello_world()
'Hello, World'
"""
return
"Hello, World"
if
__name__
==
"__main__"
:
# is 'false' if imported
import
doctest
doctest
.
testmod
()
""" RESULTS
sebastian ~/Desktop> python3 doctest_example.py
**********************************************************************
File "doctest_example.py", line 17, in __main__.hello_world
Failed example:
hello_world()
Expected:
"Hello, World"
Got:
'Hello, World'
**********************************************************************
1 items had failures:
1 of 2 in __main__.hello_world
***Test Failed*** 1 failures.
sebastian ~/Desktop>
"""
Back
|
FazBrowse Home
|
New Git URL