def testSyntax(self):
        try:
            pass
        except KeyError, e:
            pass
        except (TypeError, LookupError), e:
            pass
        except:
            pass
        finally:
            pass

        try:
            a = 1
        except:
            a = 2
        else:
            a = 3
        finally:
            self.assertEqual(a, 3)
            a = 4
        self.assertEqual(a, 4)

        try:
            a = 11
            raise KeyError('test')
        except:
            a = 12
        else:
            a = 13
        finally:
            self.assertEqual(a, 12)
            a = 14
        self.assertEqual(a, 14)

        try:
            a = 1
        finally:
            a = 2
        self.assertEqual(a, 2)
        try:
            a = 1
            try:
                b = 1
            except:
                b = 2
            else:
                b = 3
            finally:
                self.assertEqual(b, 3)
                b = 4
        except:
            a = 2
        else:
            a = 3
        finally:
            self.assertEqual(a, 3)
            a = 4
        self.assertEqual(a, 4)
        self.assertEqual(b, 4)

        sys.exc_clear()
        try:
            raise
            self.fail("No error raised on 'raise' after 'sys.exc_clear()'")
        except TypeError, e:
            # use message which works for both Python 2.5 and 2.6
            self.assertTrue(e.args[0].startswith('exceptions must be'), e.args[0])
        except:
            e = sys.exc_info()
            self.fail('TypeError expected, got %s' % e[0])

        try:
            raise KeyError, 'test'
            self.fail('No error raised')
        except KeyError, e:
            self.assertEqual(e.args[0], 'test')
        except:
            e = sys.exc_info()
            self.fail('KeyError expected, got %s' % e[0])
            e = e[1]

        try:
            raise
        except:
            err = sys.exc_info()
            self.assertEqual(e.args[0], err[1].args[0])

        raise_errors = [KeyError('KeyError'), TypeError('TypeError'),
                        AttributeError('AttributeError'),
                        LookupError('LookupError')]
        raised_errors = []
        for err in raise_errors:
            try:
                raise err
                self.fail("Failed to raise exception")
            except (KeyError, TypeError), e1:
                raised_errors.append(e1)
                if isinstance(e1, KeyError):
                    self.assertEqual(e1.args[0], 'KeyError')
                elif isinstance(e1, TypeError):
                    self.assertEqual(e1.args[0], 'TypeError')
                else:
                    self.fail('neither KeyError nor TypeError in except (KeyError, TypeError)')
            except __HOLE__, e2:
                raised_errors.append(e2)
                self.assertEqual(e2.args[0], 'AttributeError')
            except:
                e3 = sys.exc_info()[1]
                raised_errors.append(e3)
                self.assertEqual(e3.args[0], 'LookupError')
        self.assertEqual(len(raised_errors), len(raise_errors))

        try:
            try:
                raise TypeError('TypeError')
            except KeyError, e:
                self.fail("Got KeyError")
            self.fail("TypeError should not be ignored")
        except TypeError, e:
            self.assertEqual(e.args[0], 'TypeError')
dataset/ETHPy150Open pyjs/pyjs/examples/libtest/ExceptionTest.py/ExceptionTest.testSyntax