summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/tests
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46542: test_lib2to3 uses support.infinite_recursion() (GH-31035)Miss Islington (bot)2022-01-313-21/+43
| | | | | | | | | | | | | | | | | | | | | | | | * bpo-46542: test_lib2to3 uses support.infinite_recursion() Fix a Python crash in test_lib2to3 when using Python built in debug mode: limit the recursion limit. The test_all_project_files() test of test_lib2to3 now uses the test.support.infinite_recursion() context manager when processing the infinite_recursion.py file to prevent a crash when Python is built in debug mode. The two test_all_project_files() tests now use subTest() and log the refactored/parsed filename (if test_lib2to3 is run in verbose mode). * Update Lib/lib2to3/tests/data/infinite_recursion.py Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit ee0ac328d38a86f7907598c94cb88a97635b32f8) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.10] bpo-45229: Remove test_main in many tests (GH-28405) (GH-28455)Serhiy Storchaka2021-09-192-10/+4
| | | | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests. (cherry picked from commit 40348acc180580371d25f75f46b27048e35f2435)
* make lib2to3 parse async generators everywhere (GH-6588)Miss Islington (bot)2021-08-101-5/+12
| | | | | (cherry picked from commit 149addd4960d634ce672ab5fc17e0e785a0cdcd0) Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
* Update URLs in comments and metadata to use HTTPS (GH-27458) (GH-27478)Miss Islington (bot)2021-07-302-2/+2
| | | | | (cherry picked from commit be42c06bb01206209430f3ac08b72643dc7cad1c) Co-authored-by: Noah Kantrowitz <noah@coderanger.net>
* bpo-43844: Fix PendingDeprecationWarning in test_lib2to3 (GH-25407)Victor Stinner2021-04-161-4/+8
|
* bpo-36541: Add lib2to3 grammar PEP-570 pos-only arg parsing (GH-23759)Gregory P. Smith2020-12-141-0/+31
| | | | | | | | | Add positional only args support to lib2to3 pgen2. This adds 3.8's PEP-570 support to lib2to3's pgen2. lib2to3, while being deprecated is still used by things to parse all versions of Python code today. We need it to support parsing modern 3.8 and 3.9 constructs. Also add tests for complex *expr and **expr's.
* lib2to3: Support named assignment expressions (GH-12702)Tim Hatch2020-04-021-0/+15
| | | | | | | | | | | | There are two copies of the grammar -- the one used by Python itself as Grammar/Grammar, and the one used by lib2to3 which has necessarily diverged at Lib/lib2to3/Grammar.txt because it needs to support older syntax an we want it to be reasonable stable to avoid requiring fixer rewrites. This brings suport for syntax like `if x:= foo():` to match what the live Python grammar does. This should've been added at the time of the walrus operator itself, but lib2to3 being independent is often overlooked. So we do consider this a bugfix rather than enhancement.
* bpo-38080: Added "getproxies" to urllib fixes in the 2to3 tool (GH-16167)José Roberto Meza Cabrera2020-03-111-0/+4
|
* bpo-38641: Add lib2to3 support for starred expressions in return/yield ↵Vlad Emelianov2020-03-011-1/+13
| | | | | | statements (GH-16994)
* bpo-39313: Add an option to RefactoringTool for using exec as a function ↵Batuhan Taşkaya2020-01-121-3/+7
| | | | | | | | (GH-17967) https://bugs.python.org/issue39313 Automerge-Triggered-By: @pablogsal
* bpo-38871: Fix lib2to3 for filter-based statements that contain lambda ↵Dong-hee Na2020-01-071-0/+5
| | | | | | (GH-17780) Correctly parenthesize filter-based statements that contain lambda expressions in lib2to3.
* bpo-33348: parse expressions after * and ** in lib2to3 (GH-6586)Zsolt Dollenstein2019-10-241-0/+7
| | | | | | | | | | These are valid even in python 2.7 https://bugs.python.org/issue33348 Automerge-Triggered-By: @gpshead
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-35312: Make lib2to3.pgen2.parse.ParseError round-trip pickle-able. ↵Anthony Sottile2018-11-271-0/+12
| | | | (GH-10710)
* bpo-16965: 2to3 now rewrites execfile() to open with 'rb'. (GH-8569)Zackery Spytz2018-10-131-8/+8
|
* closes bpo-34515: Support non-ASCII identifiers in lib2to3. (GH-8950)Monson Shao2018-09-151-0/+10
|
* Revert "closes bpo-27494: Fix 2to3 handling of trailing comma after a ↵Serhiy Storchaka2018-07-311-7/+0
| | | | | | | | generator expression (GH-3771)" (#8241) This reverts commit af810b35b494ef1d255d4bf340b92a9dad446995. This is not valid syntax (see bpo-32012).
* bpo-21446: Update reload fixer to use importlib (GH-8391)Berker Peksag2018-07-231-6/+6
|
* bpo-34108: Fix double carriage return in 2to3 on Windows (#8271)Jason R. Coombs2018-07-131-0/+1
| | | | | * Add test capturing failure. * Honor newlines as present in the original file.
* bpo-11594: Ensure line-endings are respected when using 2to3 (GH-6483)Aaron Ang2018-04-172-17/+33
|
* Add support for all string literals to lib2to3 (#6457)Zsolt Dollenstein2018-04-161-0/+2
|
* Revert "bpo-30406: Make async and await proper keywords (#1669)" (GH-6143)Jelle Zijlstra2018-03-181-11/+11
| | | | | This reverts commit ac317700ce7439e38a8b420218d9a5035bba92ed. (Reverts only the lib2to3 part.)
* lib2to3: Add more tests (#6101)Łukasz Langa2018-03-131-0/+108
|
* bpo-33064: lib2to3: support trailing comma after *args and **kwargs (#6096)Łukasz Langa2018-03-131-3/+33
| | | | | | | New tests also added. I also made the comments in line with the builtin Grammar/Grammar. PEP 306 was withdrawn, Kees Blom's railroad program has been lost to the sands of time for at least 16 years now (I found a python-dev post from people looking for it).
* compare with difflib not diff(1) (GH-5450)Benjamin Peterson2018-01-301-13/+9
|
* closes bpo-30117: fix lib2to3 ParserIdempotency test (GH-1242)Eric Appelt2018-01-302-10/+15
| | | | | | | | | | | Fix two (in my opinion) spurious failure conditions in the lib2to3.tests.test_parser.TestParserIdempotency test_parser test. Use the same encoding found in the initial file to write a temp file for a diff. This retains the BOM if the encoding was initially utf-8-sig. If the file cannot be parsed using the normal grammar, try again with no print statement which should succeed for valid files using future print_function For case (1), the driver was correctly handling a BOM in a utf-8 file, but then the test was not writing a comparison file using 'utf-8-sig' to diff against, so the BOM got removed. I don't think that is the fault of the parser, and lib2to3 will retain the BOM. For case (2), lib2to3 pre-detects the use of from __future__ import print_function or allows the user to force this interpretation with a -p flag, and then selects a different grammar with the print statement removed. That makes the test cases unfair to this test as the driver itself doesn't know which grammar to use. As a minimal fix, the test will try using a grammar with the print statement, and if that fails fall back on a grammar without it. A more thorough handling of the idempotency test would to be to parse all files using both grammars and ignore if one of the two failed but otherwise check both. I didn't think this was necessary but can change.
* bpo-24960: use pkgutil.get_data in lib2to3 to read pickled grammar files (#4977)Benjamin Peterson2017-12-221-0/+15
| | | | | | This is more complicated than it should be because we need to preserve the useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar has. We only look for the pickled grammar file with pkgutil.get_data and only if the source file does not exist.
* bpo-32046: Update 2to3 when converts operator.isCallable(obj). (#4417)Dong-hee Na2017-11-281-2/+2
|
* bpo-30143: 2to3 now generates a code that uses abstract collection classes ↵Serhiy Storchaka2017-11-161-4/+4
| | | | | | (#1262) from collections.abc rather than collections.
* bpo-30406: Make async and await proper keywords (#1669)Jelle Zijlstra2017-10-061-11/+15
| | | Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
* closes bpo-27494: Fix 2to3 handling of trailing comma after a generator ↵Jakub Stasiak2017-10-051-0/+7
| | | | expression (#3771)
* bpo-23894: make lib2to3 recognize f-strings (#1733)Łukasz Langa2017-05-221-0/+1
| | | | | | | Note: this doesn't unpack f-strings into the underlying JoinedStr AST. Ideally we'd fully implement JoinedStr here but given its additional complexity, I think this is worth bandaiding as is. This unblocks tools like https://github.com/google/yapf to format 3.6 syntax using f-strings.
* Make rb'' strings work in lib2to3 (#1724)Łukasz Langa2017-05-221-0/+21
| | | This partially solves bpo-23894.
* bpo-29869: Allow underscores in numeric literals in lib2to3. (GH-1119)Nevada Sanchez2017-04-131-0/+22
| | | | | * Allow underscores in numeric literals in lib2to3. * Stricter literal parsing for Python 3.6 in lib2to3.pgen2.tokenize. * Add test case for underscores in literals in Python 3.
* bpo-28837: Fix lib2to3 handling of map/zip/filter calls when followed with a ↵Stuart Berg2017-04-061-9/+47
| | | | 'trailer', e.g. zip()[x] (#24)
* Remove unused imports.Serhiy Storchaka2016-12-161-1/+0
|
* Issue #25969: Update the lib2to3 grammar to handle the unpackingGregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)2016-09-102-0/+39
|\ | | | | | | generalizations added in 3.5.
| * Issue #25969: Update the lib2to3 grammar to handle the unpackingGregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)2016-09-102-0/+39
| | | | | | | | generalizations added in 3.5.
| * remove fix_callable - callable() was readded many releases ago.Gregory P. Smith2016-09-101-92/+0
| |
* | Remove 2to3's fix_callable... We reintroduced the callable built-inGregory P. Smith2016-09-101-92/+0
| | | | | | | | pretty early on in the 3.x series (3.1 or 3.2?).
* | issue27985 - fix the incorrect duplicate class name in the lib2to3Gregory P. Smith2016-09-091-1/+1
| | | | | | | | test. call it TestVarAnnotations instead.
* | Issue #28008: Implement PEP 530 -- asynchronous comprehensions.Yury Selivanov2016-09-091-0/+18
| |
* | Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.Yury Selivanov2016-09-091-0/+30
| | | | | | | | Patch by Ivan Levkivskyi.
* | Remove legacy "from __future__ import with_statement" lines.Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)2016-09-083-6/+0
| |
* | lib2to3.pgen3.driver.load_grammar() now creates a stable cache fileGregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)2016-09-082-4/+73
|\ \ | |/ | | | | | | between runs given the same Grammar.txt input regardless of the hash randomization setting.
| * lib2to3.pgen3.driver.load_grammar() now creates a stable cache fileGregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)2016-09-082-6/+72
| | | | | | | | | | between runs given the same Grammar.txt input regardless of the hash randomization setting.
* | Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes.Serhiy Storchaka2016-06-121-1/+1
| | | | | | | | Patch by Demur Rumed.
* | Issue #27030: Merge RE fix from 3.5Martin Panter2016-06-121-2/+3
|\ \ | |/
| * Fix buggy RE “\parrot_example.py”, uncovered by Issue #27030Martin Panter2016-06-121-2/+3
| |
* | Merge with 3.5Terry Jan Reedy2016-05-061-2/+2
|\ \ | |/