How do you generate dynamic (parameterized) unit tests in python?

后端 未结 25 2129
面向向阳花
面向向阳花 2020-11-22 07:09

I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this:

import unittest

l = [[\"foo\", \"a\", \"a\         


        
25条回答
  •  有刺的猬
    2020-11-22 07:23

    There's also Hypothesis which adds fuzz or property based testing: https://pypi.python.org/pypi/hypothesis

    This is a very powerful testing method.

提交回复
热议问题