Big cleanup of tests, accommodate pylint

The commit messages are quite extensive in their explanation, but the short version is that a lot of the tests weren't making great logical sense. This set of commits rearranges them sanely and makes the testing more consistent between functions.

A bunch of pylint directives have been added to get a 10/10 score, which I think is fair practice. It's not enforced, but any future changes should try and keep it that way.