From 2c25966dd6f93493bb881f7e42ac7ec770a588ba Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Sun, 12 Aug 2012 23:05:53 -0500 Subject: [PATCH] backporting assertIs and assertIsNot to objcache.py --- test/objcache.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/objcache.py b/test/objcache.py index 7342439..996ba47 100755 --- a/test/objcache.py +++ b/test/objcache.py @@ -2,9 +2,23 @@ from llvm.core import * -import logging, unittest +import logging, sys, unittest class TestObjCache(unittest.TestCase): + + if sys.version_info[:2] < (2, 7): + def assertIs(self, expr1, expr2, msg=None): + if expr1 is not expr2: + standardMsg = '%s is not %s' % (safe_repr(expr1), + safe_repr(expr2)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIsNot(self, expr1, expr2, msg=None): + if expr1 is expr2: + standardMsg = 'unexpectedly identical: %s' % (safe_repr( + expr1),) + self.fail(self._formatMessage(msg, standardMsg)) + def test_objcache(self): logging.debug("Testing module aliasing ..") m1 = Module.new('a')