You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
403 B
Python
32 lines
403 B
Python
10 years ago
|
#!/usr/bin/python
|
||
|
|
||
10 years ago
|
|
||
10 years ago
|
def foo(n):
|
||
|
"""Returns n times foo, and a period.
|
||
|
|
||
|
Just some random doctest test.
|
||
|
|
||
|
Example:
|
||
|
|
||
|
>>> foo(1)
|
||
|
'foo.'
|
||
|
|
||
|
>>> foo(5)
|
||
|
'foo foo foo foo foo.'
|
||
|
|
||
|
>>> foo(0)
|
||
|
''
|
||
|
"""
|
||
|
if n >= 1:
|
||
|
return "foo " * (n-1) + "foo."
|
||
|
else:
|
||
|
return ""
|
||
|
|
||
10 years ago
|
|
||
10 years ago
|
def _test():
|
||
|
import doctest
|
||
|
doctest.testmod()
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
_test()
|