Avoid my_dict.iteritems() in tests for Python 3 compatibility.

Using the iterator method is more memory efficient,
but for the unit tests this doesn't matter and I would
rather have the same code work under both Python 2 and 3.