classification
Title: AssertCountEqual does not work for nested dictionaries.
Type: Stage: resolved
Components: Tests Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.4, Python 3.5
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: iritkatriel, lisroach, michael.foord, rhettinger, walterqian
Priority: normal Keywords:

Created on 2019-03-06 00:42 by walterqian, last changed 2020-10-18 03:55 by rhettinger. This issue is now closed.

Messages (4)
msg337248 - (view) Author: Walter Qian (walterqian) Date: 2019-03-06 00:42
For dictionaries of dictionaries unittest.util._count_diff_all_purpose does not work correctly. It should recursively call itself when it encounters another dictionary.
msg337268 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-03-06 01:56
I believe this is outside the scope of what intended.   For the most part, the test methods need to be as direct and non-magical as possible so that we're clear on what is being tested.   Another issue with built in recursion is that different people have different notions of what is atomic, different notions of search order (depth first, breadth first, pre-order, in-order, post-order, etc), and different notions on maximum depth etc.  The unittest module leaves those decisions to the tester and instead focuses on simple and direct properties of objects under test.
msg337271 - (view) Author: Lisa Roach (lisroach) * (Python committer) Date: 2019-03-06 02:28
I agree with Raymond, I think this might end up complicating things too much. It is common in the unit test library to only recurse one level deep and not assume too much about the intentions of the tester.
msg378840 - (view) Author: Irit Katriel (iritkatriel) * (Python triager) Date: 2020-10-17 22:51
Should this be closed as won't fix?
History
Date User Action Args
2020-10-18 03:55:12rhettingersetstatus: open -> closed
resolution: rejected
stage: resolved
2020-10-17 22:51:58iritkatrielsetnosy: + iritkatriel
messages: + msg378840
2019-03-06 14:37:01vstinnersetnosy: - vstinner
2019-03-06 02:28:17lisroachsetmessages: + msg337271
2019-03-06 01:56:04rhettingersetassignee: michael.foord

messages: + msg337268
nosy: + lisroach, rhettinger, vstinner, michael.foord
2019-03-06 00:42:33walterqiancreate