Issue 25983: Add tests for multi-argument type() (original) (raw)

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 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:25 admin set github: 70171
2016-02-08 18:30:38 serhiy.storchaka set status: open -> closedresolution: fixedmessages: + stage: commit review -> resolved
2016-02-08 18:28:48 python-dev set nosy: + python-devmessages: +
2016-01-02 11:11:02 serhiy.storchaka set messages: +
2016-01-02 00:10:17 terry.reedy set nosy: + terry.reedymessages: +
2015-12-31 19:47:25 brett.cannon set nosy: + brett.cannonmessages: + assignee: serhiy.storchakastage: patch review -> commit review
2015-12-31 15:32:24 serhiy.storchaka create