Q: Limitations of assertEqual The docs for assertEqual in Python unittest say

assertEqual(first, second, msg=None)
Test that first and second are equal. If the values do not compare equal, the test will fail

If my inputs, first & second are deep nested objects (e.g. dict of list of dict and list etc.), are there any limitation to what cannot be compared with the above assert statement? So far, I know that if at any depth, there's a list, its order has to match on both sides (because that's how I would normally compare a list).
There's no specific mention of nested objects in the docs and I couldn't find a clear answer to it.

A: assertEqual calls the appropriate type equality function (if available).  e.g. assertEqual on lists actually calls assertListEqual.  If no type equality function is specified, assertEqual simply uses the == operator to determine equality.
Note that you can make and register your own type equality functions if you wish.
If you want to look at the actual implementation, assertListEqual simply delegates to assertSequenceEqual which ultimately uses != to compare items.  If the sub-items are nested, it gets compared however python compares those items.  For example, lists are considered equal if:

Sequence types also support comparisons. In particular, tuples and lists are compared lexicographically by comparing corresponding elements. This means that to compare equal, every element must compare equal and the two sequences must be of the same type and have the same length. (For full details see Comparisons in the language reference.)

See the docs on python sequences.
