Skip to content

Instantly share code, notes, and snippets.

@rubik
Created September 29, 2012 13:58
Show Gist options
  • Save rubik/3804074 to your computer and use it in GitHub Desktop.
Save rubik/3804074 to your computer and use it in GitHub Desktop.
Subclassing example with rik0's ParamUnittest
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