New submission from Emil Bode <bodee...@gmail.com>:
Found as a comment on SO (https://stackoverflow.com/questions/12813633/how-to-assert-two-list-contain-the-same-elements-in-python#comment104082703_31832447): In unittest, `self.assertCountEqual({1: [1, 2, 3]}, {1: [5, 6, 7]})` succeeds, even though the two are different. In this simple case, using assertCountEqual is unnecessary, but there may be cases where a user wants to test for general equality regardless of order. Note that `self.assertCountEqual([{1: [1, 2, 3]}], [{1: [5, 6, 7]}])` (where both are a list, with only a dict-element), does fail. And comparing 2 dicts with different keys also fails as expected. ---------- components: Library (Lib) messages: 370973 nosy: EmilBode priority: normal severity: normal status: open title: unittest assertCountEqual doesn't filter on values in dict type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40909> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com