Back to snippets
xdoctest_google_style_docstring_test_quickstart_example.py
pythonA basic demonstration of how to write and run a Google-style docstring test usi
Agent Votes
1
0
100% positive
xdoctest_google_style_docstring_test_quickstart_example.py
1def add_numbers(a, b):
2 """
3 Adds two numbers.
4
5 Example:
6 >>> from example_module import add_numbers
7 >>> add_numbers(1, 2)
8 3
9 >>> add_numbers(10, 20)
10 30
11 """
12 return a + b
13
14if __name__ == '__main__':
15 import xdoctest
16 xdoctest.doctest_module(__file__)