小编Mat*_*usz的帖子

遵循 Head First Python 第二版时出现 Pytest-pep8 问题

我一直在关注 Head First Python 第二版,在第 4 章中演示了 pep8 合规性测试。尽管代码与书中相同,但我的输出是不同的。

\n\n

测试代码非常简单:

\n\n
def search4vowels(phrase: str) -> set:\n    """Return vowels found in supplied phrase."""\n    vowels = set(\'aeiou\')\n    return vowels.intersection(set(phrase))\n\n\ndef search4letters(phrase: str, letters: str=\'aeiou\') -> set:\n    """Return a set of \'letters\' found in \'phrase\'."""\n    return set(letters).intersection(set(phrase))\n
Run Code Online (Sandbox Code Playgroud)\n\n

我尝试按照书中所示进行测试,并得到以下输出:

\n\n
\xce\xbb py.test.exe --pep8 vsearch.py\nc:\\users\\gx\\appdata\\local\\programs\\python\\python37-32\\lib\\site-packages\\pep8.py:110: FutureWarning: Possible nested set at position 1\n  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r\'[[({] | []}),;:]\')\n============================= test session starts =============================\nplatform win32 -- Python 3.7.4, pytest-5.1.1, py-1.8.0, pluggy-0.12.0\nrootdir: C:\\Users\\gx\\Desktop\\H.F. Python\\mymodules\nplugins: pep8-1.0.6\ncollected 1 item\n\nvsearch.py . …
Run Code Online (Sandbox Code Playgroud)

python pep8 pytest

5
推荐指数
1
解决办法
1419
查看次数

标签 统计

pep8 ×1

pytest ×1

python ×1