summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_grammar.py
Commit message (Collapse)AuthorAgeFilesLines
* allow keyword args to be passed in after *args #3473Benjamin Peterson2008-08-191-0/+8
|
* Forward-port new test from r64300.Georg Brandl2008-06-151-0/+1
|
* Issue#2238: some syntax errors from *args or **kwargs expressionsAmaury Forgeot d'Arc2008-03-051-0/+4
| | | | | | | | | | | | | | would give bogus error messages, because of untested exceptions:: >>> f(**g(1=2)) XXX undetected error Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'int' object is not iterable instead of the expected SyntaxError: keyword can't be an expression Will backport.
* Patch #1759: Backport of PEP 3129 class decoratorsChristian Heimes2008-02-231-0/+10
| | | | with some help from Georg
* #1920: when considering a block starting by "while 0", the compiler ↵Amaury Forgeot d'Arc2008-01-241-0/+9
| | | | | | | | | | | | | | | | | optimized the whole construct away, even when an 'else' clause is present:: while 0: print("no") else: print("yes") did not generate any code at all. Now the compiler emits the 'else' block, like it already does for 'if' statements. Will backport.
* Fix #1679: "0x" was taken as a valid integer literal.Georg Brandl2008-01-191-0/+2
| | | | | Fixes the tokenizer, tokenize.py and int() to reject this. Patches by Malte Helmert.
* Backport PEP 3110's new 'except' syntax to 2.6.Collin Winter2007-05-181-2/+2
|
* Bug #1588287: fix invalid assertion for `1,2` in debug builds.Neal Norwitz2006-11-041-0/+2
| | | | Will backport
* Whitespace normalization.Tim Peters2006-11-031-5/+5
|
* Test assert if __debug__ is true.Georg Brandl2006-10-291-4/+3
|
* make test_grammar pass with python -OGeorg Brandl2006-10-281-2/+4
|
* Convert test_global, test_scope and test_grammar to unittest.Georg Brandl2006-10-281-825/+887
| | | | | I tried to enclose all tests which must be run at the toplevel (instead of inside a method) in exec statements.
* Bug #1520864 (again): unpacking singleton tuples in list comprehensions andNeal Norwitz2006-09-051-0/+4
| | | | | | | | | | | | | generator expressions (x for x, in ... ) works again. Sigh, I only fixed for loops the first time, not list comps and genexprs too. I couldn't find any more unpacking cases where there is a similar bug lurking. This code should be refactored to eliminate the duplication. I'm sure the listcomp/genexpr code can be refactored. I'm not sure if the for loop can re-use any of the same code though. Will backport to 2.5 (the only place it matters).
* Bug #1520864: unpacking singleton tuples in for loop (for x, in) work again.Neal Norwitz2006-07-121-0/+5
|
* Part two of the fix for SF bug #1466641: Regenerate graminit.c and add testThomas Wouters2006-04-121-0/+5
| | | | for the bogus failure.
* Fix SF bug #1458903 with AST compiler.Neal Norwitz2006-03-271-0/+4
| | | | | | | | | | | | def foo((x)): was getting recognized as requiring tuple unpacking which is not correct. Add tests for this case and the proper way to unpack a tuple of one: def foo((x,)): test_inpsect was incorrect before. I'm not sure why it was passing, but that has been corrected with a test for both functions above. This means the test (and therefore inspect.getargspec()) are broken in 2.4.
* Update commentsNeal Norwitz2006-02-281-1/+2
|
* Test case to cover subscription bug from SF 1333982Jeremy Hylton2006-02-281-0/+11
|
* PEP 308 implementation, including minor refdocs and some testcases. ItThomas Wouters2006-02-271-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | breaks the parser module, because it adds the if/else construct as well as two new grammar rules for backward compatibility. If no one else fixes parsermodule, I guess I'll go ahead and fix it later this week. The TeX code was checked with texcheck.py, but not rendered. There is actually a slight incompatibility: >>> (x for x in lambda:0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: iteration over non-sequence changes into >>> (x for x in lambda: 0) File "<stdin>", line 1 (x for x in lambda: 0) ^ SyntaxError: invalid syntax Since there's no way the former version can be useful, it's probably a bugfix ;)
* SF #1377897, Bus error in astNeal Norwitz2005-12-111-0/+4
| | | | | | If a line had multiple semi-colons and ended with a semi-colon, we would loop too many times and access a NULL node. Exit the loop early if there are no more children.
* Merge ast-branch to headJeremy Hylton2005-10-201-9/+16
| | | | | | | | | | This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
* Add test for ``class B1(): pass``.Brett Cannon2005-04-091-1/+2
|
* SF patch #1007189, multi-line imports, for instance:Anthony Baxter2004-08-311-1/+5
| | | | | "from blah import (foo, bar baz, bongo)"
* SF patch #872326: Generator expression implementationRaymond Hettinger2004-05-191-0/+43
| | | | | | | | | | | | | | (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.
* Replace backticks with repr() or "%r"Walter Dörwald2004-02-121-2/+2
| | | | From SF patch #852334.
* - Removed FutureWarnings related to hex/oct literals and conversionsGuido van Rossum2003-11-291-6/+6
| | | | | | | | | | and left shifts. (Thanks to Kalle Svensson for SF patch 849227.) This addresses most of the remaining semantic changes promised by PEP 237, except for repr() of a long, which still shows the trailing 'L'. The PEP appears to promise warnings for operations that changed semantics compared to Python 2.3, but this is not implemented; we've suffered through enough warnings related to hex/oct literals and I think it's best to be silent now.
* Whitespace normalization.Tim Peters2003-06-151-1/+1
|
* Fix for SF [ 734869 ] Lambda functions in list comprehensionsJeremy Hylton2003-05-211-0/+1
| | | | | | The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module. Repair by move tmpname into the symtable entry. Bugfix candidate.
* SF #660455 : patch by NNorwitz.Guido van Rossum2003-02-121-1/+3
| | | | | | | | | | "Unsigned" (i.e., positive-looking, but really negative) hex/oct constants with a leading minus sign are once again properly negated. The micro-optimization for negated numeric constants did the wrong thing for such hex/oct constants. The patch avoids the optimization for all hex/oct constants. This needs to be backported to Python 2.2!
* Restore the hex/oct constant tests that Barry commented out for fearGuido van Rossum2002-08-291-2/+9
| | | | of FutureWarnings. Added a comment explaining the situation.
* Fixed three exceptions in the Plain integers test, although I'm notBarry Warsaw2002-08-291-3/+3
| | | | | | | | | | | sure these are the best fixes. - Test maxint-1 against the negative octal constant -020000000000 - Comment out the tests for oct -1 and hex -1, since 037777777777 and 0xffffffff raise FutureWarnings now and in Python 2.4 those constants will produce positive values, not negative values. So the existing test seems to test something that won't be true in 2.4.
* Quite down some FutureWarnings.Barry Warsaw2002-08-281-3/+3
|
* Complete the absolute import patch for the test suite. All relativeBarry Warsaw2002-07-301-1/+1
| | | | | | | | imports of test modules now import from the test package. Other related oddities are also fixed (like DeprecationWarning filters that weren't specifying the full import part, etc.). Also did a general code cleanup to remove all "from test.test_support import *"'s. Other from...import *'s weren't changed.
* The initial patch #468662 was not applied quite verbatim. This should oneFinn Bock2001-12-091-1/+2
| | | | | | will fix the remaining Jython issues. This closes patch "[ #490411 ] Jython and test_grammar.py".
* SF patch [ #468662 ] Allow jython to complete test_grammarJeremy Hylton2001-10-101-4/+14
| | | | | | The behavior of co_varnames in the presence of nested argument tuples is not consistent across Python and Jython. Test each platform separately.
* Test case for SF bugs #463359 and #462937, added to test_grammar for lack ofThomas Wouters2001-09-261-0/+27
| | | | | a better place. Excessively fragile code, but at least it breaks when something in this area changes!
* Make these modules work when Python is compiled without Unicode support.Guido van Rossum2001-09-211-0/+4
|
* Fix another test still expecting overflow on big int literals.Tim Peters2001-08-271-7/+2
|
* Add test for a list comprehension that is nested in the left-hand partJeremy Hylton2001-03-191-0/+5
| | | | | | | | | of another list comp. This caused crashes reported as SF bugs 409230 and 407800. Note that the new tests are in a function so that the name lookup code isn't affected by how many *other* list comprehensions are in the same scope.
* Add test case for global stmt at module level.Jeremy Hylton2001-02-281-0/+3
| | | | | Fix test_grammar so that it ignores warning about global stmt at module level in exec.
* Add simple section for assert, including assert w/ lambdasJeremy Hylton2001-02-191-0/+6
|
* Add test for syntax error on "x = 1 + 1".Jeremy Hylton2001-02-191-8/+3
| | | | Move check_syntax() function into test_support.
* update test cases for recent compiler changes: exec/import * in nestedJeremy Hylton2001-02-091-1/+0
| | | | functinos and cell vars with */** parameters
* Whitespace normalization.Tim Peters2001-02-091-1/+1
|
* Allow 'continue' inside 'try' clauseJeremy Hylton2001-02-011-0/+19
| | | | SF patch 102989 by Thomas Wouters
* Undo recent change that banned using import to bind a global, as perJeremy Hylton2001-02-011-1/+0
| | | | | | | | | | | discussion on python-dev. 'from mod import *' is still banned except at the module level. Fix value for special NOOPT entry in symtable. Initialze to 0 instead of None, so that later uses of PyInt_AS_LONG() are valid. (Bug reported by Donn Cave.) replace local REPR macros with PyObject_REPR in object.h
* add test for illegal importsJeremy Hylton2001-01-301-0/+2
|
* PEP 227 implementationJeremy Hylton2001-01-251-0/+14
| | | | | test_new: new.code() noew takes two more arguments test_grammer: Add a bunch of test cases for lambda (not really PEP 227 related)
* add extra tests to verify that co_varnames is being set up properlyJeremy Hylton2001-01-251-22/+19
| | | | | also normalize checks for syntax errors and delete commented out definition of verify.
* Add simple test of list comprehension that uses a name that isn'tJeremy Hylton2001-01-231-0/+6
| | | | | otherwise used in the same code block. (Not sure this is the right place, but there is no test_list_comprehensions.py.)