Created
September 29, 2012 13:58
-
-
Save rubik/3804074 to your computer and use it in GitHub Desktop.
Subclassing example with rik0's ParamUnittest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from paramunittest import * | |
@parametrized((1, 2)) | |
class TestLess(ParametrizedTestCase): | |
def setParameters(self, a, b): | |
self.a = a | |
self.b = b | |
def meth(self): | |
return (self.a * self.b) % self.b | |
def testLess(self): | |
self.assertLess(self.a, self.b) | |
self.assertLess(self.meth(), self.a) | |
@parametrized((2, 3)) | |
class AdditionalTests(get_class('TestLess')): | |
'''Test additional features (maybe add unittest.skipIf(sys.version_info[:2] < (3, 0)) ...)''' | |
if __name__ == '__main__': | |
import unittest | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment