我在文件./src/string.py
内有以下代码
#!/usr/bin/env python3.7
def extract_upper(phrase):
"""
Take sthe string and returns the only uppercase letters
The following is a doctest
>>> extract_upper("Hello There, BOB")
['H', 'T', 'B', 'O', '']
"""
return list(filter(str.isupper, phrase))
def extract_lower(phrase):
return list(filter(str.islower, phrase))
if __name__=='__main__':
print(f'Hello from string')
print(f"__name__ in string.py {__name__}")
当我从cmdline运行以下命令时。
python3.7 -m doctest -v src/helpers/string.py
这不会进行任何测试。我得到以下输出。
19 items had no tests:
string
string.Formatter
string.Formatter._vformat
string.Formatter.check_unused_args
string.Formatter.convert_field
string.Formatter.format
string.Formatter.format_field
string.Formatter.get_field
string.Formatter.get_value
string.Formatter.parse
string.Formatter.vformat
string.Template
string.Template.__init__
string.Template._invalid
string.Template.safe_substitute
string.Template.substitute
string._TemplateMetaclass
string._TemplateMetaclass.__init__
string.capwords
0 tests in 19 items.
0 passed and 0 failed.
Test passed.
有人可以帮我解决我做错了什么或我想念什么