This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年02月23日 21:27 by vincele, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| add-more-tests-for-ast_py.patch | vincele, 2011年02月23日 21:27 | Patch adding more tests to test_ast.py | review | |
| add-more-tests-for-ast_py-2.patch | vincele, 2011年06月27日 14:07 | Patch adding more tests to test_ast.py - version 2 | ||
| add-more-tests-for-ast_py-3.patch | vincele, 2011年06月27日 15:27 | Patch adding more tests to test_ast.py - version 3 | ||
| Messages (11) | |||
|---|---|---|---|
| msg129225 - (view) | Author: Vincent Legoll (vincele) | Date: 2011年02月23日 21:27 | |
While working to improve pypy's compliance with cpython2.7 I added more tests to the ast module test suite. They may be of interest here too... |
|||
| msg129235 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2011年02月24日 01:24 | |
Please upload to Rietveld. I have a few comments to make. |
|||
| msg139189 - (view) | Author: Sandro Tosi (sandro.tosi) * (Python committer) | Date: 2011年06月26日 15:16 | |
Hi Benjamin, we know have rietveld directly integrated in the tracker, so it might be time to add you comments? If you still can remember them, given it passed some time :) |
|||
| msg139258 - (view) | Author: Vincent Legoll (vincele) | Date: 2011年06月27日 11:47 | |
OK I'll look at it and respin with the comments in mind |
|||
| msg139275 - (view) | Author: Vincent Legoll (vincele) | Date: 2011年06月27日 14:07 | |
Here we are, I left the exact messages for raised exceptions as comments so they can easily be checked in case of test failure... Does that look OK ? |
|||
| msg139286 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2011年06月27日 14:41 | |
You still haven't explained why including multiline literals is a good idea.
Also, the reason we avoid matching exact messages is it can vary across implementations. You can still do an accurate test with something like self.assertIn("foobar", str(e))
|
|||
| msg139292 - (view) | Author: Vincent Legoll (vincele) | Date: 2011年06月27日 15:06 | |
I was testing exact matches on the strings because I think pypy wants to be as compliant as possible with cpython, and IMHO that include exception msgs as far as possible. I don't see any reason to be different just for the sake of it.
As a user I'd find strange not to get same exc msgs from different implementations, and it'll make me loose some time digging why those difference exist...
Back to the patch:
The multiline (and also differing offsets) are there for testing .lineno & .col_offset AST node's attributes. (there was a bug in pypy's implementation of those back then...)
Do you want that explained in the comment ?
Do you want me to add "self.assertIn("foobar", str(e))" in the tests, remove the comments or let them as in the patch #2 ?
|
|||
| msg139293 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月27日 15:08 | |
> I think pypy wants to be as compliant as possible with cpython, and > IMHO that include exception msgs as far as possible. I don't see any > reason to be different just for the sake of it. > > As a user I'd find strange not to get same exc msgs from different > implementations, and it'll make me loose some time digging why those > difference exist... The language reference purposefully makes no guarantee about the error messages, and in some cases about exception types too (AttributeError vs. TypeError), so your feeling contradict Python’s rules. |
|||
| msg139294 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2011年06月27日 15:09 | |
2011年6月27日 Vincent Legoll <report@bugs.python.org>: > > Vincent Legoll <vincent.legoll@gmail.com> added the comment: > > I was testing exact matches on the strings because I think pypy wants to be as compliant as possible with cpython, and IMHO that include exception msgs as far as possible. I don't see any reason to be different just for the sake of it. It's not difference just for the sake of it. Exact compatibility with errors messages is not particularly useful as long as they have the same semantic meaning. > > As a user I'd find strange not to get same exc msgs from different implementations, and it'll make me loose some time digging why those difference exist... The usually mean the same thing; they're just worded differently. > > Back to the patch: > > The multiline (and also differing offsets) are there for testing .lineno & .col_offset AST node's attributes. (there was a bug in pypy's implementation of those back then...) > > Do you want that explained in the comment ? > > Do you want me to add "self.assertIn("foobar", str(e))" in the tests, remove the comments or let them as in the patch #2 ? If you want, you can test the exc message with the assertIn pattern. I don't find there's much potential for mistaking where the attribute error is in "x.not_an_attribute". :) |
|||
| msg139299 - (view) | Author: Vincent Legoll (vincele) | Date: 2011年06月27日 15:27 | |
* removed the comments for exc msgs * added explanation to multiline statements * added 2 tests to test_AST_objects() Regarding Éric's comment, I'm starting to wonder if those Exception tests should be added to cpython's testsuite. Maybe that would only be beneficial for pypy... |
|||
| msg139331 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年06月27日 22:51 | |
New changeset 3143cadb2f2d by Benjamin Peterson in branch '2.7': add more ast tests (closes #11302) http://hg.python.org/cpython/rev/3143cadb2f2d New changeset e8d47cbe9b6f by Benjamin Peterson in branch '3.2': add more ast tests (closes #11302) http://hg.python.org/cpython/rev/e8d47cbe9b6f New changeset 323cf9acbccd by Benjamin Peterson in branch 'default': merge 3.2 (#11302) http://hg.python.org/cpython/rev/323cf9acbccd |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:13 | admin | set | github: 55511 |
| 2011年06月27日 22:51:48 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg139331 resolution: fixed stage: patch review -> resolved |
| 2011年06月27日 15:27:20 | vincele | set | files:
+ add-more-tests-for-ast_py-3.patch messages: + msg139299 |
| 2011年06月27日 15:09:57 | benjamin.peterson | set | messages: + msg139294 |
| 2011年06月27日 15:08:44 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg139293 |
| 2011年06月27日 15:06:11 | vincele | set | messages: + msg139292 |
| 2011年06月27日 14:41:13 | benjamin.peterson | set | messages: + msg139286 |
| 2011年06月27日 14:07:02 | vincele | set | files:
+ add-more-tests-for-ast_py-2.patch messages: + msg139275 |
| 2011年06月27日 11:47:43 | vincele | set | messages: + msg139258 |
| 2011年06月26日 15:16:39 | sandro.tosi | set | nosy:
+ sandro.tosi messages: + msg139189 stage: patch review |
| 2011年02月24日 01:24:40 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages: + msg129235 |
| 2011年02月23日 21:27:33 | vincele | create | |