Created
October 10, 2011 21:32
-
-
Save Lothiraldan/1276611 to your computer and use it in GitHub Desktop.
Example with unittest templates and a typo in the function.
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 | |
from poc import TemplateTestCase, Call, template | |
def support_http_method(method): | |
if method in ('POST', 'GETT'): | |
return True | |
else: | |
return False | |
class SupportHttpMethodTestCase(unittest.TestCase): | |
__metaclass__ = TemplateTestCase | |
support_args = { | |
'post': Call('POST', True), | |
'get': Call('GET', True), | |
'put': Call('PUT', False), | |
'delete': Call('DELETE', False) | |
} | |
@template(support_args) | |
def _test_support(self, method, expected): | |
self.assertEquals(support_http_method(method), expected) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment