Issue 7210: Proposed Syntax Checks in Test Suite (original) (raw)

Created on 2009-10-26 19:40 by ChuckRhode, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (12)

msg94501 - (view)

Author: Chuck Rhode (ChuckRhode)

Date: 2009-10-26 19:40

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')

msg94503 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2009-10-26 20:16

Please provided a unified diff against the trunk.

msg94539 - (view)

Author: Chuck Rhode (ChuckRhode)

Date: 2009-10-26 23:14

You mean like this?

msg94540 - (view)

Author: Chuck Rhode (ChuckRhode)

Date: 2009-10-26 23:25

Well, the last two patch files weren't very good, but I hope the third time's the charm.

msg94541 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2009-10-26 23:27

That still looks like it's against Python 2.5.

msg94569 - (view)

Author: Chuck Rhode (ChuckRhode)

Date: 2009-10-27 18:18

Yet another patch file....

msg94639 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2009-10-28 21:02

Please just add your test case to the bottom of the trunk...

msg94692 - (view)

Author: Chuck Rhode (ChuckRhode)

Date: 2009-10-30 02:51

Sorry I'm having so much trouble with this patch. Here's another. Thanks for your patience. -ccr-

msg94732 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2009-10-30 22:19

See how all the other tests in test_grammar are written in a unittest style?

msg94742 - (view)

Author: Chuck Rhode (ChuckRhode)

Date: 2009-10-31 03:40

Oh! That's very different. :-)

I can do that.

msg94743 - (view)

Author: Benjamin Peterson (benjamin.peterson) * (Python committer)

Date: 2009-10-31 03:56

Applied with some changes in r75971.

msg94757 - (view)

Author: Chuck Rhode (ChuckRhode)

Date: 2009-10-31 14:09

Thanks. -ccr-

History

Date

User

Action

Args

2022-04-11 14:56:54

admin

set

github: 51459

2009-10-31 14:09:37

ChuckRhode

set

messages: +

2009-10-31 03:56:37

benjamin.peterson

set

status: open -> closed
resolution: accepted
messages: +

2009-10-31 03:40:36

ChuckRhode

set

files: + test_grammar_trunk.diff

messages: +

2009-10-31 03:36:13

ChuckRhode

set

files: - test_grammar.patch

2009-10-30 22:19:43

benjamin.peterson

set

messages: +

2009-10-30 02:51:26

ChuckRhode

set

files: + test_grammar.patch

messages: +

2009-10-30 02:50:01

ChuckRhode

set

files: - test_grammar.patch

2009-10-28 21:02:27

benjamin.peterson

set

messages: +

2009-10-27 18🔞31

ChuckRhode

set

files: + test_grammar.patch

messages: +

2009-10-26 23:27:15

benjamin.peterson

set

messages: +

2009-10-26 23:25:37

ChuckRhode

set

files: + test_grammar.patch

messages: +

2009-10-26 23:23:54

ChuckRhode

set

files: - test_grammar.patch

2009-10-26 23:17:50

ChuckRhode

set

files: - test_grammar.patch

2009-10-26 23:14:54

ChuckRhode

set

files: + test_grammar.patch

messages: +

2009-10-26 20:16:03

benjamin.peterson

set

nosy: + benjamin.peterson
messages: +

2009-10-26 19:40:18

ChuckRhode

create