python doctest: expected result is the same as the “got” result but the test failed

前端 未结 2 805

I am on a learning stage of using python as a tool for software QA.

I wrote the next simple test in order to find the letter \'a\' in a text file number matrix. prob

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-18 01:53

    This:

    return;
    

    Makes your function return None.

    Did you mean return t?


    Besides that, IMHO doctest tests are meant to be self-contained. This is something the user should see in your documentation and understand without context. In your example, you're using a module-local arr_fin_1 object which is completely opaque to the user. It's better to define it in the doctest before the find_letter call to provide a self-contained example.

提交回复
热议问题