Created
December 9, 2011 22:56
-
-
Save MarkBennett/1453692 to your computer and use it in GitHub Desktop.
Python functional programming
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
import unittest | |
class MyTestCase(unittest.TestCase): | |
@classmethod | |
def make_an_example_of(cls, example_name, example): | |
def example_test_template(self): | |
self.assertEqual(stuff, example) | |
setattr(cls, "test_an_example_of_%s" %(example_name), example_test_template) | |
MyTestCase.make_an_example_of("Bob") | |
MyTestCase.make_an_example_of("Frank") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Obviously, you would provide a more comprehensive example with input and output params for each example.