tests: support assertIn/assertNotIn in python-2.6
authorMike Frysinger <vapier@gentoo.org>
Mon, 21 Oct 2013 02:11:05 +0000 (22:11 -0400)
committerMike Frysinger <vapier@gentoo.org>
Mon, 21 Oct 2013 02:12:58 +0000 (22:12 -0400)
pym/portage/tests/__init__.py

index 6c5c4dfd5203481141945ce6c416305b97d162d6..84e732a1c96bf1666ce9aec074bbd746434579d6 100644 (file)
@@ -279,9 +279,16 @@ if unittest_skip_shims:
 
        def skipTest(self, reason):
                raise SkipTest(reason)
-
        setattr(TestCase, 'skipTest', skipTest)
 
+       def assertIn(self, member, container, msg=None):
+               self.assertTrue(member in container, msg=msg)
+       setattr(TestCase, 'assertIn', assertIn)
+
+       def assertNotIn(self, member, container, msg=None):
+               self.assertFalse(member in container, msg=msg)
+       setattr(TestCase, 'assertNotIn', assertNotIn)
+
 class TextTestRunner(unittest.TextTestRunner):
        """
        We subclass unittest.TextTestRunner to output SKIP for tests that fail but are skippable