New submission from Chuck Rhode <crh...@lacusveris.com>: PythonTidy is a code beautifier written three years ago and downloaded numerous times.
o http://lacusveris.com/PythonTidy/PythonTidy.python It suffers a bug, which has only recently come to light. It considers the following lines equivalent: if False is (2 is 3): pass if False is 2 is 3: pass They're not. PythonTidy handles other non-associative operators such as division correctly. I was unable to generalize from arithmetic operators to comparison operators because the Abstract Syntax Tree (AST) generated by the *compiler* module returns a different structure for them. I tested PythonTidy by running the Python Test Suite (the *test* module scripts) through it and executing the results, thought I had all my bases covered because most tests succeeded, and missed this case, so I am suggesting an amplification of the Python Test Suite for developers who may be using it for purposes other than testing Python. I wish to add these lines to the foot of *test_grammar.py*. verify(16 // (4 // 2) == 8, '16 // (4 // 2) == 8') verify((16 // 4) // 2 == 2, '(16 // 4) // 2 == 2') verify(16 // 4 // 2 == 2, '16 // 4 // 2 == 2') verify((False is (2 is 3)) == True, '(False is (2 is 3)) == True') verify(((False is 2) is 3) == False, '(((False is 2) is 3) == False') verify((False is 2 is 3) == False, '(False is 2 is 3) == False') ---------- components: Tests files: test_grammar.patch keywords: patch messages: 94501 nosy: ChuckRhode severity: normal status: open title: Proposed Syntax Checks in Test Suite type: feature request versions: Python 2.5 Added file: http://bugs.python.org/file15206/test_grammar.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7210> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com