Fixed tests II.

This commit is contained in:
Jakub Roztočil 2012-03-04 12:02:30 +01:00
parent a44ef6c443
commit 7d629b4d94

View File

@ -1,3 +1,4 @@
import sys
import unittest
import argparse
from StringIO import StringIO
@ -21,25 +22,14 @@ def http(*args, **kwargs):
class BaseTest(unittest.TestCase):
if sys.version < (2, 7):
def assertIn(self, member, container, msg=None):
sup = super(BaseTest, self)
if hasattr('sup', 'assertIn'):
sup.assertIn(member, container, msg)
else:
self.assert_(member in container, msg)
def assertNotIn(self, member, container, msg=None):
sup = super(BaseTest, self)
if hasattr(sup, 'assertNotIn'):
sup.assertNotIn(member, container, msg)
else:
self.assert_(member not in container, msg)
def assertDictEqual(self, d1, d2, msg=None):
sup = super(BaseTest, self)
if hasattr(sup, 'assertDictEqual'):
sup.assertDictEqual(d1, d2, msg)
else:
self.assertEqual(set(d1.keys()), set(d2.keys()), msg)
self.assertEqual(sorted(d1.values()), sorted(d2.values()), msg)