python - PEP8 用于长方法的名称

标签 python unit-testing pep8 django-unittest

<分区>

长方法名称的 PEP8 正确方法是什么? 我有一个带有 self 描述方法的单元测试:

def success_if_buying_price_item_when_participating_and_progression_is_100_percent(self):

但不幸的是,这个(太长了?)方法达到了 80 个字符的行限制。

我应该重命名它并在代码中添加描述还是有其他方法?

最佳答案

Should I rename it and add a description in code or there is an other way?

是的,重命名并添加描述。此代码很危险,一个人可能会从椅子上摔下来,而另一个人可能会心脏病发作。请尽快重命名,您不想承担责任。

关于python - PEP8 用于长方法的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19984877/

相关文章:

python - 在 Python 中创建静态类

python - flake8 不报告大小写混合的函数名称

python - 如何获得无限数据结构?

python - 基于日期时间索引屏蔽数据框列

python selenium 点击第n个元素

javascript - 在提供程序配置中对 $urlRouterProvider.otherwise 进行单元测试

python - 使用正则表达式解析字符串python3

unit-testing - Grails测试应用错误

c# - Umbraco 单元测试

python - 惯用的 Python - 检查零