I am testing part of unit testing, and I need to make sure that the function always returns an object of type np.datetime64. However, they can be any unit (year, day, nanosecond, etc.).
I tried:
comp = function_returns_datetime_array(inp)
assert isinstance(comp.dtype, np.datetime64)
assert issubclass(comp.dtype, np.datetime64)
assert issubclass(type(comp.dtype), np.datetime64)
Any suggestions?
source
share