summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/tests/data
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/tests/data')
-rw-r--r--Lib/lib2to3/tests/data/different_encoding.py3
-rw-r--r--Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py2
-rw-r--r--Lib/lib2to3/tests/data/py2_test_grammar.py22
-rw-r--r--Lib/lib2to3/tests/data/py3_test_grammar.py20
4 files changed, 42 insertions, 5 deletions
diff --git a/Lib/lib2to3/tests/data/different_encoding.py b/Lib/lib2to3/tests/data/different_encoding.py
index 4bb82bd..888f51f 100644
--- a/Lib/lib2to3/tests/data/different_encoding.py
+++ b/Lib/lib2to3/tests/data/different_encoding.py
@@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
-print(u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')
-
+print u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ'
diff --git a/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py b/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py
index 6bd2f49..6db79ad 100644
--- a/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py
+++ b/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py
@@ -10,4 +10,4 @@ class FixParrot(BaseFix):
def transform(self, node, results):
name = results["name"]
- name.replace(Name("cheese", name.get_prefix()))
+ name.replace(Name("cheese", name.prefix))
diff --git a/Lib/lib2to3/tests/data/py2_test_grammar.py b/Lib/lib2to3/tests/data/py2_test_grammar.py
index dc794e2..17f9f4c 100644
--- a/Lib/lib2to3/tests/data/py2_test_grammar.py
+++ b/Lib/lib2to3/tests/data/py2_test_grammar.py
@@ -1,5 +1,3 @@
-# Python 2's Lib/test/test_grammar.py (r66189)
-
# Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
@@ -922,6 +920,26 @@ hello world
self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6])
self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9])
+ def test_with_statement(self):
+ class manager(object):
+ def __enter__(self):
+ return (1, 2)
+ def __exit__(self, *args):
+ pass
+
+ with manager():
+ pass
+ with manager() as x:
+ pass
+ with manager() as (x, y):
+ pass
+ with manager(), manager():
+ pass
+ with manager() as x, manager() as y:
+ pass
+ with manager() as x, manager():
+ pass
+
def testIfElseExpr(self):
# Test ifelse expressions in various cases
def _checkeval(msg, ret):
diff --git a/Lib/lib2to3/tests/data/py3_test_grammar.py b/Lib/lib2to3/tests/data/py3_test_grammar.py
index eadf1db..977f0b8 100644
--- a/Lib/lib2to3/tests/data/py3_test_grammar.py
+++ b/Lib/lib2to3/tests/data/py3_test_grammar.py
@@ -868,6 +868,26 @@ class GrammarTests(unittest.TestCase):
self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6])
self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9])
+ def test_with_statement(self):
+ class manager(object):
+ def __enter__(self):
+ return (1, 2)
+ def __exit__(self, *args):
+ pass
+
+ with manager():
+ pass
+ with manager() as x:
+ pass
+ with manager() as (x, y):
+ pass
+ with manager(), manager():
+ pass
+ with manager() as x, manager() as y:
+ pass
+ with manager() as x, manager():
+ pass
+
def testIfElseExpr(self):
# Test ifelse expressions in various cases
def _checkeval(msg, ret):