ParamUnittest jest narzędziem Python zaprojektowany, aby umożliwić tworzenie testów jednostkowych parametryzowaną zdolnych do pracy z oficjalnego pakietu unittest Pythona.
Przykłady:
Import unittest
Import paramunittest
@ Paramunittest.parametrized (
& Nbsp; ('1' "2"),
& Nbsp; # (4, 3),
& Nbsp; ("2", "3"),
& Nbsp; (("4"), {'b': '5'}),
& Nbsp; (() {'': 5, 'b': 6}),
& Nbsp; {'': 5, 'b': 6},
)
Klasa TestFoo (paramunittest.ParametrizedTestCase):
& Nbsp; def setParameters (self, a, b):
& Nbsp; self.a =
& Nbsp; self.b = b
& Nbsp; def testLess (self):
& Nbsp; self.assertLess (self.a, self.b)
@ Paramunittest.parametrized (
& Nbsp; ('1' "2"),
& Nbsp; # (4, 3),
& Nbsp; ("2", "3"),
& Nbsp; (("4"), {'b': '5'}),
& Nbsp; (() {'': 5, 'b': 6}),
& Nbsp; {'': 5, 'b': 6},
)
Klasa TestBar (unittest.TestCase):
& Nbsp; def setParameters (self, a, b):
& Nbsp; self.a =
& Nbsp; self.b = b
& Nbsp; def testLess (self):
& Nbsp; self.assertLess (self.a, self.b)
Wymagania :
- Python
Komentarze nie znaleziono