'A context manager that asserts the given objects have the
same reference counts before and after executing the
enclosed block.'

@contextlib.contextmanager
def assertRefCount(self, *objects):

    old_refcounts = [sys.getrefcount(x) for x in objects]
    (yield)
    new_refcounts = [sys.getrefcount(x) for x in objects]
    for (old, new, obj) in zip(old_refcounts, new_refcounts, objects):
        if (old != new):
            self.fail(('Refcount    changed    from    %d    to    %d    for    object:    %r' % (old, new, obj)))
