mirror of
https://github.com/python/cpython.git
synced 2025-07-12 05:45:15 +00:00
46 lines
545 B
Python
46 lines
545 B
Python
"""This is a sample module used for testing doctest.
|
|
|
|
This module includes various scenarios involving errors.
|
|
|
|
>>> 2 + 2
|
|
5
|
|
>>> 1/0
|
|
1
|
|
"""
|
|
|
|
def g():
|
|
[][0] # line 12
|
|
|
|
def errors():
|
|
"""
|
|
>>> 2 + 2
|
|
5
|
|
>>> 1/0
|
|
1
|
|
>>> def f():
|
|
... 2 + '2'
|
|
...
|
|
>>> f()
|
|
1
|
|
>>> g()
|
|
1
|
|
"""
|
|
|
|
def syntax_error():
|
|
"""
|
|
>>> 2+*3
|
|
5
|
|
"""
|
|
|
|
__test__ = {
|
|
'bad': """
|
|
>>> 2 + 2
|
|
5
|
|
>>> 1/0
|
|
1
|
|
""",
|
|
}
|
|
|
|
def test_suite():
|
|
import doctest
|
|
return doctest.DocTestSuite()
|