homepage

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.

classification
Title: add test for defaultdict with non-callable first argument
Type: Stage: resolved
Components: Tests Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: ezio.melotti, mike.c, python-dev
Priority: normal Keywords: easy, patch

Created on 2011年12月05日 11:55 by mike.c, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
defaultdict_callable_test.patch mike.c, 2011年12月05日 13:16 review
defaultdict_callable_test_v2.patch mike.c, 2011年12月05日 13:29 review
Messages (7)
msg148868 - (view) Author: mike c (mike.c) Date: 2011年12月05日 11:55
Could a test be added to ./Lib/test/test_defaultdict.py to test for TypeError being thrown when the the first argument to collections.defaultdict is not callable? 
pypy does not behave the same way as CPython 2.7.2 as the problem is not covered in the testcases.
e.g.
def test_callable_arg:
 d1 = defaultdict({})
 self.assertRaises(TypeError) # TypeError: first argument must be callable
msg148869 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011年12月05日 11:57
Sure, do you want to propose a patch? (You can see the devguide for more information.)
msg148870 - (view) Author: mike c (mike.c) Date: 2011年12月05日 12:11
Cloning repo. Reading the devguide. Patch forthcoming.
msg148871 - (view) Author: mike c (mike.c) Date: 2011年12月05日 13:16
Patch to add a defaultdict test which checks that if the first argument is not callable, then a TypeError is thrown.
msg148872 - (view) Author: mike c (mike.c) Date: 2011年12月05日 13:29
patch v2. Now with assertRaises()!
msg148995 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011年12月07日 22:04
New changeset a8deeb549e1a by Ezio Melotti in branch '2.7':
#13531: add a test for defaultdict with a non-callable arg. Patch by Mike Cheng.
http://hg.python.org/cpython/rev/a8deeb549e1a
New changeset 17ceebc61b65 by Ezio Melotti in branch '3.2':
#13531: add a test for defaultdict with a non-callable arg. Patch by Mike Cheng.
http://hg.python.org/cpython/rev/17ceebc61b65
New changeset 4180308547d9 by Ezio Melotti in branch 'default':
#13531: merge with 3.2.
http://hg.python.org/cpython/rev/4180308547d9 
msg148997 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011年12月07日 22:08
Committed, thanks for the report and the patch!
For the record, this is related to https://bugs.pypy.org/issue953 
History
Date User Action Args
2022年04月11日 14:57:24adminsetgithub: 57740
2011年12月07日 22:08:20ezio.melottisetstatus: open -> closed
resolution: fixed
messages: + msg148997

stage: commit review -> resolved
2011年12月07日 22:04:10python-devsetnosy: + python-dev
messages: + msg148995
2011年12月07日 17:15:14ezio.melottisetassignee: ezio.melotti
stage: test needed -> commit review
2011年12月05日 13:29:56mike.csetfiles: + defaultdict_callable_test_v2.patch

messages: + msg148872
2011年12月05日 13:16:30mike.csetfiles: + defaultdict_callable_test.patch
keywords: + patch
messages: + msg148871
2011年12月05日 12:11:29mike.csetmessages: + msg148870
2011年12月05日 11:57:40ezio.melottisetversions: + Python 3.2, Python 3.3
nosy: + ezio.melotti

messages: + msg148869

keywords: + easy
stage: test needed
2011年12月05日 11:55:22mike.ccreate

AltStyle によって変換されたページ (->オリジナル) /