Skip to content

Instantly share code, notes, and snippets.

@gnurag
Created May 3, 2013 12:18
Show Gist options
  • Save gnurag/5508789 to your computer and use it in GitHub Desktop.
Save gnurag/5508789 to your computer and use it in GitHub Desktop.
Auto adding tests.
import unittest
class AutoTest(unittest.TestCase):
def check(self, x, y):
self.assertEquals(x, y)
for x in xrange(0,4):
for y in xrange(0, 4):
def lcheck(x, y):
return lambda self: self.check(x, y)
setattr(AutoTest, "test_%r_%r_equality" % (x, y) , lcheck(x, y))
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment