Created
October 10, 2011 20:28
-
-
Save Lothiraldan/1276416 to your computer and use it in GitHub Desktop.
First solution with a loop inside test method.
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 | |
def support_http_protocol(protocol): | |
if protocol in ('POST', 'GET'): | |
return True | |
else: | |
return False | |
class SupportHttpProtocolTestCase(unittest.TestCase): | |
def test_support(self): | |
expected_values = { | |
'POST': True, | |
'GET': True, | |
'PUT': False, | |
'DELETE': False | |
} | |
for protocol, expected in expected_values.items(): | |
self.assertEqual(support_http_protocol(protocol), expected) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment