fix python2 comparisons by explicitly raising `TypeError`

Python2's weird comparison semantics are inconsistent with what
we expect when `NotImplemented` is returned.
2 jobs for bugfix/comparison
Status Name Job ID Coverage
  Test
passed python2 #464

00:00:10

passed python3 #465

00:00:10