def test_get_depthseries_output_format(self): from cognite.v05.dto import TimeSeriesResponse series = depthseries.get_depthseries(prefix=DS_NAME) assert isinstance(series, TimeSeriesResponse) assert isinstance(series.to_ndarray(), np.ndarray) assert isinstance(series.to_pandas(), pd.DataFrame) assert isinstance(series.to_json()[0], dict)
def create_depthseries(self): tso = dto.TimeSeries(DS_NAME) tso2 = dto.TimeSeries(DS2_NAME) try: res = depthseries.post_depth_series([tso2, tso]) except: pass yield depthseries.get_depthseries(prefix=DS_NAME) try: depthseries.delete_depth_series(DS_NAME) depthseries.delete_depth_series(DS2_NAME) except: pass
def test_get_depthseries_no_results(self): result = depthseries.get_depthseries(prefix="not_a_depthseries_prefix") assert result.to_pandas().empty assert len(result.to_json()) == 0
def test_get_depthseries_confirm_names(self): df = depthseries.get_depthseries(prefix=DS_NAME).to_pandas() assert df.loc[df.index[0], "name"] == DS_NAME assert df.loc[df.index[1], "name"] == DS_NAME + "_DepthIndex"
def test_depthseries_unit_correct(self): tso = dto.TimeSeries(DS_NAME, unit="celsius") res = depthseries.update_depth_series([tso]) series = depthseries.get_depthseries(prefix=DS_NAME) assert series.to_json()[0]["unit"] == "celsius" assert series.to_json()[1]["unit"] == "m"