def test_contextmanager(self): """ Covers context manager interface. """ with Context(self) as ctx: self.assertIs(ctx, Context.top()) with Context(self) as ctx2: self.assertIsNot(ctx2, ctx) self.assertIs(ctx2, Context.top()) self.assertIs(ctx, Context.top())
def test_push_pop(self): """ Covers Context.push(), Context.pop(), Context.top() """ ctx = Context(self) Context.push(ctx) self.assertIs(ctx, Context.top()) Context.pop(ctx)