Skip to content

Commit 1e346e7

Browse files
author
Ray Bell
committed
add test
1 parent 0080140 commit 1e346e7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
import os
2+
import pytest
3+
4+
from intake import open_catalog
5+
from xarray.tests import assert_allclose
6+
7+
8+
# Function used in xarray_source_sel entry in catalog.yaml
19
def _sel(ds, indexers: str):
210
"""indexers: dict (stored as str) which is passed to xarray.Dataset.sel"""
311
return ds.sel(eval(indexers))
12+
13+
14+
@pytest.fixture
15+
def catalog():
16+
path = os.path.dirname(__file__)
17+
return open_catalog(os.path.join(path, "data", "catalog.yaml"))
18+
19+
20+
def test_catalog(catalog):
21+
expected = catalog["xarray_source"].read().sel(lat=20)
22+
actual = catalog["xarray_source_sel"].read()
23+
assert_allclose(actual, expected)

0 commit comments

Comments
 (0)