The assertRaisesRegexp name was deprecated in Python 3.2 in favor of
assertRaisesRegex. Our minimum version requirement is Python 3.5, so
this change is fully backwards compatible for our purposes.
The np.all() check would raise a DeprecationWarning if the lengths of
the two arrays were not equal. The required additional length check
means the early termination moves inside the if-else for __iter__ (i.e.
is "t" an np.ndarray or a float). Note that we can skip the length check
when "t" is a float, making the early termination a little more
generic (also working when len(ts) > 1).