【问题标题】:Convention for test method names in PythonPython 中测试方法名称的约定
【发布时间】:2021-02-17 06:29:43
【问题描述】:

我有一个测试类 AbbreviationGenerator 的测试。类名应该使用驼峰式,而方法名应该小写。然后我应该将测试方法命名为test_AbbreviationGenerator 还是test_abbreviation_generator?

【问题讨论】:

  • test_abbreviation_generator – 见PEP-0008

标签: python naming-conventions


【解决方案1】:

如果测试是一个方法(如您所说),那么它与一个类相关联,假设该类名为 AbbreviationGeneratorTest。然后你可以简单地将方法命名为 run。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-11-10
    • 2019-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-14
    • 2011-02-12
    相关资源
    最近更新 更多