~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/lib2to3/tests/data/py2_test_grammar.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Python 2's Lib/test/test_grammar.py (r66189)
2
 
 
3
1
# Python test set -- part 1, grammar.
4
2
# This just tests whether the parser accepts them all.
5
3
 
922
920
        self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6])
923
921
        self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9])
924
922
 
 
923
    def test_with_statement(self):
 
924
        class manager(object):
 
925
            def __enter__(self):
 
926
                return (1, 2)
 
927
            def __exit__(self, *args):
 
928
                pass
 
929
 
 
930
        with manager():
 
931
            pass
 
932
        with manager() as x:
 
933
            pass
 
934
        with manager() as (x, y):
 
935
            pass
 
936
        with manager(), manager():
 
937
            pass
 
938
        with manager() as x, manager() as y:
 
939
            pass
 
940
        with manager() as x, manager():
 
941
            pass
 
942
 
925
943
    def testIfElseExpr(self):
926
944
        # Test ifelse expressions in various cases
927
945
        def _checkeval(msg, ret):