PEP8 naming convention on test classes

前端 未结 2 845
青春惊慌失措
青春惊慌失措 2021-01-01 10:22

I have been looking at PEP 8 -- Style Guide for Python Code and PEP8 -- Advanced Usage for clues on how to name my test classes. However, this is never mentioned on both sit

2条回答
  •  感情败类
    2021-01-01 11:19

    The documentation for unittest suggests, e.g.:

    class TestSequenceFunctions(unittest.TestCase):
    
        def test_shuffle(self):
            ...
    
        def test_choice(self):
            ...
    

    commenting

    The three individual tests are defined with methods whose names start with the letters test. This naming convention informs the test runner about which methods represent tests.

提交回复
热议问题