From df09aee439bdf21de44107653b97a1d799d52343 Mon Sep 17 00:00:00 2001 From: Guillaume Maze Date: Tue, 21 Jan 2025 15:25:57 +0100 Subject: [PATCH] Update test_stores_float.py --- argopy/tests/test_stores_float.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/argopy/tests/test_stores_float.py b/argopy/tests/test_stores_float.py index 929bbdaf..c2308e93 100644 --- a/argopy/tests/test_stores_float.py +++ b/argopy/tests/test_stores_float.py @@ -2,6 +2,7 @@ import tempfile import xarray as xr +import pandas as pd import importlib import shutil import logging @@ -51,6 +52,10 @@ class Test_FloatStore_Offline(): def test_init(self, wmo): ArgoFloatOffline(wmo, host=self.host) + def test_dac_notfound(self): + with pytest.raises(ValueError): + ArgoFloatOffline(123456, host=self.host) + def id_for_host(host): """Get a short name for scenarios IDs, given a FTP host""" @@ -137,12 +142,20 @@ def store_maker(self, request): yield self.get_a_floatstore(wmo, host=host, cache=cache, xfail=xfail, reason=reason) def assert_float(self, this_af): + assert isinstance(this_af.load_index(), ArgoFloatOnline) + assert hasattr(this_af, "dac") assert isinstance(this_af.dac, str) assert hasattr(this_af, "metadata") assert isinstance(this_af.metadata, dict) + assert hasattr(this_af, "technicaldata") + assert isinstance(this_af.technicaldata, dict) + + assert hasattr(this_af, "api_point") + assert isinstance(this_af.api_point, dict) + assert isinstance(this_af.N_CYCLES, int) assert isinstance(this_af.path, str) assert isinstance(this_af.host_sep, str) @@ -150,21 +163,18 @@ def assert_float(self, this_af): assert isinstance(this_af.list_dataset(), dict) assert is_list_of_strings(this_af.ls()) + assert is_list_of_strings(this_af.lsprofiles()) + assert isinstance(this_af.describe_profiles(), pd.DataFrame) def assert_open_dataset(self, this_af): lds = this_af.list_dataset() - log.debug(lds) dsname, _ = random.choice(list(lds.items())) - log.info(dsname) assert isinstance(this_af.open_dataset(dsname), xr.Dataset) with pytest.raises(ValueError): this_af.open_dataset('dummy_dsname') - log.debug(this_af.ls()) - - ######### # TESTS # #########