Convert bare expressions to assertions

There were several instances of tests like `foo == 23`, but nothing really
happens if that's untrue. Python discards the results of expressions that
aren't assigned or otherwise used. This patch converts those to assertions
so that the tests will fail loudly when they don't pass, instead of silently
continuing on to the next statement.
Minor pylint cleanups

Unused imports, assignment to variables that aren't used, replacing
`foo != None` with `foo is not None`, extraneous whitespace.

Nothing show-stopping, but we might as well make it look pretty. :-)