Skip to content

Commit 14807de

Browse files
committed
Fix the tests by forcing engine fastparquet
1 parent 72f684e commit 14807de

File tree

2 files changed

+9
-28
lines changed

2 files changed

+9
-28
lines changed

kerchunk/_grib_idx.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6969
""" # noqa: E501
7070

71-
7271
import ujson
7372
import itertools
7473
import os

tests/test__grib_idx.py

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,8 @@ def test_build_idx_grib_mapping(self):
248248
f"{mapping_fname}.idx_grib_mapping.parquet",
249249
)
250250
# Build the mapping from idx to cfgrib metadata and assert it matches the fixture
251-
expected = pd.read_parquet(test_path)
252-
pd.testing.assert_frame_equal(
253-
mapping,
254-
expected.assign(
255-
step=lambda x: x.step.astype("timedelta64[ns]")
256-
),
257-
)
251+
expected = pd.read_parquet(test_path, engine="fastparquet")
252+
pd.testing.assert_frame_equal(mapping, expected)
258253

259254
# parse the idx files for 20231104 and compare the mapped result to the direct indexed result
260255
test_name = fnames["20231104"]
@@ -289,11 +284,7 @@ def test_build_idx_grib_mapping(self):
289284
"20231104",
290285
f"{test_name}.kindex.parquet",
291286
)
292-
expected = pd.read_parquet(kindex_test_path)
293-
294-
expected = expected.assign(
295-
step=lambda x: x.step.astype("timedelta64[ns]")
296-
)
287+
expected = pd.read_parquet(kindex_test_path, engine="fastparquet")
297288

298289
expected = expected.set_index(
299290
["varname", "typeOfLevel", "stepType", "step", "level"]
@@ -393,13 +384,8 @@ def test_kerchunk_indexing(self):
393384
TEST_DATE,
394385
f"{fname}.kindex.parquet",
395386
)
396-
expected = pd.read_parquet(test_path)
397-
pd.testing.assert_frame_equal(
398-
kindex,
399-
expected.assign(
400-
step=lambda x: x.step.astype("timedelta64[ns]")
401-
),
402-
)
387+
expected = pd.read_parquet(test_path, engine="fastparquet")
388+
pd.testing.assert_frame_equal(kindex, expected)
403389

404390
@unittest.skip("TODO")
405391
def test_extract_dataset_chunk_index(self):
@@ -444,10 +430,8 @@ def _test_index_extraction(self, sample_prefix: str):
444430
test_path = os.path.join(
445431
THIS_DIR, "grib_idx_fixtures", sample_prefix, "kerchunk_index.parquet"
446432
)
447-
expected = pd.read_parquet(test_path)
448-
pd.testing.assert_frame_equal(
449-
k_index, expected.assign(step=lambda x: x.step.astype("timedelta64[ns]"))
450-
)
433+
expected = pd.read_parquet(test_path, engine="fastparquet")
434+
pd.testing.assert_frame_equal(k_index, expected)
451435

452436
def test_strip_datavar_chunks(self):
453437
for sample_prefix, pre, post in [
@@ -583,7 +567,8 @@ def _reinflate_grib_store(
583567
kind = pd.read_parquet(
584568
os.path.join(
585569
THIS_DIR, "grib_idx_fixtures", dataset, "test_reinflate.parquet"
586-
)
570+
),
571+
engine="fastparquet",
587572
)
588573

589574
zstore = reinflate_grib_store(
@@ -666,9 +651,6 @@ def _reinflate_grib_store(
666651
with fsspec.open(test_path, "r") as f:
667652
expected_keys = ujson.loads(f.read())
668653

669-
if key_set != expected_keys:
670-
print("hello")
671-
672654
self.assertListEqual(key_set, expected_keys)
673655

674656
def test_reinflate_grib_store(self):

0 commit comments

Comments
 (0)