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 tests for multi-argument type()
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: brett.cannon, python-dev, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2015-12-31 15:32 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
type_tests.patch serhiy.storchaka, 2015-12-31 15:32 review
Messages (6)
msg257257 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-12-31 15:32
I had not added tests for issue25961 because couldn't find a good place for adding new tests. It looks that there are no special tests for creating new type with type() at all.

Proposed patch adds separate class with tests in test_builtin (may be this is not the best place, I'm not sure). They test type() with valid and invalid arguments, and also test setting some attributes, because error handling should be consistent for constructor and setters. There are some of setting tests in test_descr, but this doesn't look a good place for testing the constructor.
msg257259 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2015-12-31 19:47
LGTM and I think test_builtins works well enough (unless you really wanted to go through the effort of consolidating all type-related types into a single test_type module).
msg257320 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-01-02 00:10
I presume that there are existing tests that class statements work.  Is so, these implicitly test type(name, bases, namespace).  But I can see value to test testing the two phases of class creation separately. Test 'class' with a mock type that records the arguments passed, and separately test type explicitly.
msg257343 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-01-02 11:11
There is test_class, but it tests different things. There is test_metaclass, it 
contains doctests for class statements with metaclasses.
msg259871 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-02-08 18:28
New changeset f9bd6ddb6ba4 by Serhiy Storchaka in branch '2.7':
Issue #25983: Added tests for multi-argument type().
https://hg.python.org/cpython/rev/f9bd6ddb6ba4

New changeset 0e7aabe76159 by Serhiy Storchaka in branch '3.5':
Issue #25983: Added tests for multi-argument type().
https://hg.python.org/cpython/rev/0e7aabe76159

New changeset f494052eb476 by Serhiy Storchaka in branch 'default':
Issue #25983: Added tests for multi-argument type().
https://hg.python.org/cpython/rev/f494052eb476
msg259872 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-02-08 18:30
Thanks for your review Brett. I have landed tests in test_builtins.
History
Date User Action Args
2022-04-11 14:58:25adminsetgithub: 70171
2016-02-08 18:30:38serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg259872

stage: commit review -> resolved
2016-02-08 18:28:48python-devsetnosy: + python-dev
messages: + msg259871
2016-01-02 11:11:02serhiy.storchakasetmessages: + msg257343
2016-01-02 00:10:17terry.reedysetnosy: + terry.reedy
messages: + msg257320
2015-12-31 19:47:25brett.cannonsetnosy: + brett.cannon
messages: + msg257259

assignee: serhiy.storchaka
stage: patch review -> commit review
2015-12-31 15:32:24serhiy.storchakacreate