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

前端 未结 2 804

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.

    0 讨论(0)
  • 2021-01-18 02:15

    You've got an extra space after the 97 - if you remove it, your test should run fine.

    0 讨论(0)
提交回复
热议问题