

def testSimple(self):
    with self.Dummy():
        pass
    with self.Dummy() as v:
        pass
    d = self.Dummy()
    with d:
        pass
    self.assertTrue(d.enter_called)
    self.assertTrue(d.exit_called)
    z = None
    with self.Dummy(10) as v:
        z = v
    self.assertEqual(z, 10)
    self.fail('Bug #XXX - With statement fails for unknown reason')
    return
    d = self.Dummy(gobble=True)
    with d:
        raise Exception()
    self.assertEqual(type(d.exc_info[1]), Exception)

dataset/ETHPy150Open pyjs/pyjs/examples/libtest/WithTest.py WithTest.testSimple/original