diff options
author | Dan Wendlandt <dan@nicira.com> | 2011-09-07 14:27:06 -0700 |
---|---|---|
committer | Dan Wendlandt <dan@nicira.com> | 2011-09-07 14:27:06 -0700 |
commit | 0f5eb3f888de5f6eb23f968fa5a2270d2a350bcc (patch) | |
tree | 0ee3f8a60147da042b0b14db350a320228876fa6 /nova/test.py | |
parent | e5e3b306985a3b1fdd8a971f48b76eaf8f923f21 (diff) | |
parent | 3e0698e3b57c9f73a359340f51c2797d8adc669a (diff) | |
download | nova-0f5eb3f888de5f6eb23f968fa5a2270d2a350bcc.tar.gz nova-0f5eb3f888de5f6eb23f968fa5a2270d2a350bcc.tar.xz nova-0f5eb3f888de5f6eb23f968fa5a2270d2a350bcc.zip |
merge trunk
Diffstat (limited to 'nova/test.py')
-rw-r--r-- | nova/test.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/nova/test.py b/nova/test.py index 88f1489e8..d759aef60 100644 --- a/nova/test.py +++ b/nova/test.py @@ -277,3 +277,21 @@ class TestCase(unittest.TestCase): continue else: self.assertEqual(sub_value, super_value) + + def assertIn(self, a, b, *args, **kwargs): + """Python < v2.7 compatibility. Assert 'a' in 'b'""" + try: + f = super(TestCase, self).assertIn + except AttributeError: + self.assertTrue(a in b, *args, **kwargs) + else: + f(a, b, *args, **kwargs) + + def assertNotIn(self, a, b, *args, **kwargs): + """Python < v2.7 compatibility. Assert 'a' NOT in 'b'""" + try: + f = super(TestCase, self).assertNotIn + except AttributeError: + self.assertFalse(a in b, *args, **kwargs) + else: + f(a, b, *args, **kwargs) |