I\'m dong some unit testing and I need to make sure a function always returns a np.datetime64-like object. However, they can be of any unit (year, day, nanosecond, etc).
Currently I'm using:
assert 'datetime64' in str(comp.dtype)
It leaves a bad taste in my mouth (since it relies on other behavior), but its all I can some up with.
You can use issubdtype:
np.issubdtype(comp.dtype, np.datetime64)