Correct tests to work on both Python2 and Python3

Some simple iterator and list fixes.