How do I concisely implement multiple similar unit tests in the Python unittest framework?

后端 未结 9 1056
予麋鹿
予麋鹿 2020-12-24 15:10

I\'m implementing unit tests for a family of functions that all share a number of invariants. For example, calling the function with two matrices produce a matrix of known s

9条回答
  •  一向
    一向 (楼主)
    2020-12-24 15:43

    I see that this question is old. I'm not sure about back then, but today maybe you could use some "data-driven testing" packages:

    • https://github.com/wolever/nose-parameterized
    • http://ddt.readthedocs.org/en/latest/example.html

提交回复
热议问题