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 2008年04月19日 22:09 by danderson, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| mapping-tests.diff | doerwalter, 2014年06月29日 09:05 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11157 | merged | doerwalter, 2018年12月14日 12:07 | |
| Messages (10) | |||
|---|---|---|---|
| msg65639 - (view) | Author: David Anderson (danderson) | Date: 2008年04月19日 22:09 | |
Some test cases in Lib/test/mapping_tests.py are problematic for users wishing to test their own implementations of the mapping protocol: - TestHashMappingProtocol.test_repr() requires the user implementations to look like a dict when repr() is applied. It is unclear why this is required of conforming mapping protocol implementations. - TestMappingProtocol.test_fromkeys() cannot pass for any implementation that uses its constructor in fromkeys(), because baddict1 defines a constructor accepting no arguments. It should accept *args, **kwargs to be sane for user implementations that handle passing data sources to the constructor. - TestHashMappingProtocol.test_mutatingiteration(), for some faulty implementations, makes the iteration degrade into an infinite loop. Making the test more strict (eg. keeping an explicit iteration count and failing if it goes >1) would be more helpful to buggy implementations. These all seem like trivial issues. If it is agreed that the repr_test should be removed from the ABC tests, I can provide a patch implementing these three corrections. |
|||
| msg87739 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2009年05月14日 16:28 | |
Walter, this is your code. Care to incorporate any of David's ideas? David, for my own code, the usual technique for something like test_repr() is to subclass TestHashMappingProtocol and override the test method with a customized test_repr() method. |
|||
| msg87762 - (view) | Author: Walter Dörwald (doerwalter) * (Python committer) | Date: 2009年05月14日 20:44 | |
Any custom mapping class should have a repr test anyway, so IMHO it doesn't matter whether the base test has a repr test or not. The suggested fixes for TestMappingProtocol.test_fromkeys() and TestHashMappingProtocol.test_mutatingiteration() sound OK however. David, can you provide a patch? |
|||
| msg153835 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年02月21日 02:39 | |
I think it would be great to test the stdlib’s mapping classes against common tests; there is a patch to add more MutableMapping methods to dbm classes for example, and it was not trivial to get good test coverage. Not sure about the status of the module though, i.e. if we should officially support people using mapping_tests to check their code; it would be very useful for classes that don’t inherit from an ABC, but the whole test package is not intended for public use. |
|||
| msg153843 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年02月21日 03:26 | |
> I think it would be great to test the stdlib’s mapping classes against common tests grep told me that most of them already do. Sorry for the noise, it’s late/soon here. |
|||
| msg221825 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2014年06月29日 00:19 | |
@Walter/Raymond as there is still no patch for this issue do you want to leave it open just in case anybody wants to work on it, move it to langushing, close it or what? |
|||
| msg221832 - (view) | Author: Walter Dörwald (doerwalter) * (Python committer) | Date: 2014年06月29日 09:05 | |
Here is a patch that implements suggestion 2 and 3. |
|||
| msg331686 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2018年12月12日 09:41 | |
Walter, do you mind to create a PR? |
|||
| msg331812 - (view) | Author: Walter Dörwald (doerwalter) * (Python committer) | Date: 2018年12月14日 12:11 | |
OK, I've created the pull request (11157). |
|||
| msg344797 - (view) | Author: miss-islington (miss-islington) | Date: 2019年06月06日 10:13 | |
New changeset 6af230359e57122708247dac970e05e05529cde6 by Miss Islington (bot) (Walter Dörwald) in branch 'master': bpo-2661: Make mapping tests better usable for custom mapping classes. (GH-11157) https://github.com/python/cpython/commit/6af230359e57122708247dac970e05e05529cde6 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:33 | admin | set | github: 46913 |
| 2019年06月06日 10:14:31 | cheryl.sabella | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: + Python 3.9, - Python 2.7, Python 3.2, Python 3.3 |
| 2019年06月06日 10:13:13 | miss-islington | set | nosy:
+ miss-islington messages: + msg344797 |
| 2018年12月14日 12:11:30 | doerwalter | set | messages: + msg331812 |
| 2018年12月14日 12:07:28 | doerwalter | set | stage: needs patch -> patch review pull_requests: + pull_request10390 |
| 2018年12月12日 16:09:34 | BreamoreBoy | set | nosy:
- BreamoreBoy |
| 2018年12月12日 09:41:24 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg331686 |
| 2014年06月29日 09:05:53 | doerwalter | set | files:
+ mapping-tests.diff keywords: + patch messages: + msg221832 |
| 2014年06月29日 00:19:37 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg221825 |
| 2012年02月21日 03:26:04 | eric.araujo | set | messages: + msg153843 |
| 2012年02月21日 02:39:56 | eric.araujo | set | versions:
+ Python 2.7, Python 3.2, Python 3.3, - Python 3.1 nosy: + eric.araujo messages: + msg153835 stage: needs patch |
| 2009年05月14日 20:44:38 | doerwalter | set | messages: + msg87762 |
| 2009年05月14日 16:28:46 | rhettinger | set | priority: normal -> low nosy: + doerwalter messages: + msg87739 assignee: doerwalter |
| 2009年05月12日 13:22:08 | pitrou | set | nosy:
+ rhettinger |
| 2009年05月12日 13:09:10 | ajaksu2 | set | priority: normal components: + Tests versions: + Python 3.1, - Python 3.0 |
| 2008年04月19日 22:09:32 | danderson | create | |