nose-parameterizedNose decorator for parameterized testing | |
Download |
nose-parameterized Ranking & Summary
Advertisement
- License:
- Other/Proprietary Li...
- Price:
- FREE
- Publisher Name:
- David Wolever
- Publisher web site:
- https://github.com/wolever/
nose-parameterized Tags
nose-parameterized Description
nose-patameterized is a decorator for parameterized testing with nose.Nose. It's got test generators. But they kind of suck, because:- They often require a second function- They make it difficult to separate the data from the test- They don't work with subclases of unittest.TestCaseBut nose-parameterized fixes that.Check it out: cat test_math.pyfrom nose.tools import assert_equalfrom nose_parameterized import parameterizedimport unittestimport math@parameterized()def test_pow(base, exponent, expected): assert_equal(math.pow(base, exponent), expected)class TestMathUnitTest(unittest.TestCase): @parameterized.expand() def test_floor(self, input, expected): assert_equal(math.floor(input), expected)$ nosetests -v test_math.pytest_math.test_pow(2, 2, 4) ... oktest_math.test_pow(2, 3, 8) ... oktest_math.test_pow(1, 9, 1) ... oktest_math.test_pow(0, 9, 0) ... oktest_floor_0 (test_math.TestMathUnitTest) ... oktest_floor_1 (test_math.TestMathUnitTest) ... oktest_floor_2 (test_math.TestMathUnitTest) ... ok----------------------------------------------------------------------Ran 7 tests in 0.002sOKProduct's homepage
nose-parameterized Related Software