def testForLoop(self):
        n1 = 0
        n2 = 0
        for i in range(10):
            n1 += i
            for i in xrange(4):
                n2 += i
        self.assertEqual(n1, 45)
        self.assertEqual(n2, 60)
        self.assertEqual(i, 3)

        try:
            for i in xrange(4):
                raise StopIteration
            self.fail("Failed to raise StopIteration")
        except __HOLE__:
            self.assertTrue(True)
        self.assertEqual(i, 0)

        e = 0
        i = -1
        for i in range(1):
            pass
        else:
            e = 1
        self.assertEqual(i, 0)
        self.assertEqual(e, 1)

        e = 0
        i = -1
        for i in range(0):
            pass
        else:
            e = 1
        self.assertEqual(i, -1)
        self.assertEqual(e, 1, "bug #316 for X in Y:... else ...")

        e = 0
        i = -1
        for i in range(1):
            e = 1
            break
        else:
            e = 2
        self.assertEqual(i, 0)
        self.assertEqual(e, 1)
dataset/ETHPy150Open anandology/pyjamas/examples/libtest/BuiltinTest.py/BuiltinTest.testForLoop