Fix tests for Python <= 2.6

This commit is contained in:
Vincent Jacques
2013-03-29 13:26:53 +01:00
parent 4df3a7eb47
commit f266fed520
+6 -3
View File
@@ -28,10 +28,13 @@ class Enterprise(Framework.BasicTestCase):
g = github.Github(self.login, self.password, base_url="http://my.enterprise.com")
self.assertListKeyEqual(g.get_user().get_repos(), lambda r: r.name, ["TestPyGithub", "django", "PyGithub", "developer.github.com", "acme-public-website", "C4Planner", "Hacking", "vincent-jacques.net", "Contests", "Candidates", "Tests", "DrawTurksHead", "DrawSyntax", "QuadProgMm", "Boost.HierarchicalEnum", "ViDE"])
def testUnknownUrlScheme(self):
with self.assertRaises(AssertionError) as cm:
def testUnknownUrlScheme(self): # To stay compatible with Python 2.6, we do not use self.assertRaises with only one argument
try:
github.Github(self.login, self.password, base_url="foobar://my.enterprise.com")
self.assertEqual(cm.exception.args[0], "Unknown URL scheme")
except AssertionError, exception:
raised = True
self.assertEqual(exception.args[0], "Unknown URL scheme")
self.assertTrue(raised)
def testLongUrl(self):
g = github.Github(self.login, self.password, base_url="http://my.enterprise.com/path/to/github")