From 7d629b4d9480c73b50668e741fbb7ee110cf6a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Roztoc=CC=8Cil?= Date: Sun, 4 Mar 2012 12:02:30 +0100 Subject: [PATCH] Fixed tests II. --- tests.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/tests.py b/tests.py index 276784f5..93a6bca5 100644 --- a/tests.py +++ b/tests.py @@ -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): - def assertIn(self, member, container, msg=None): - sup = super(BaseTest, self) - if hasattr('sup', 'assertIn'): - sup.assertIn(member, container, msg) - else: + if sys.version < (2, 7): + def assertIn(self, member, container, msg=None): 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: + def assertNotIn(self, member, container, msg=None): 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: + def assertDictEqual(self, d1, d2, msg=None): self.assertEqual(set(d1.keys()), set(d2.keys()), msg) self.assertEqual(sorted(d1.values()), sorted(d2.values()), msg)