Skip to content

Commit f7c4e64

Browse files
committed
Add initial coverage tests for converter.py
1 parent 850a6eb commit f7c4e64

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copyright Commonwealth of Australia, Bureau of Meteorology 2025.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
from pyearthtools.utils.data import converter
17+
import xarray as xr
18+
19+
SIMPLE_DATA_ARRAY = xr.DataArray([1,2,3,4,5])
20+
SIMPLE_DATA_SET = xr.Dataset({"Entry": SIMPLE_DATA_ARRAY})
21+
22+
23+
def test_NumpyConverter():
24+
'''
25+
This test provides coverage, but does not test for
26+
correctness
27+
'''
28+
29+
nc = converter.NumpyConverter()
30+
np_array1 = nc.convert_from_xarray(SIMPLE_DATA_ARRAY)
31+
np_array2 = nc.convert_from_xarray(SIMPLE_DATA_SET)
32+
33+
# FIXME
34+
# xr_da1 = nc.convert_to_xarray(np_array1)
35+
36+
37+
def test_DaskConverter():
38+
'''
39+
This test provides coverage, but does not test for
40+
correctness
41+
'''
42+
43+
dc = converter.DaskConverter()
44+
45+
da_array1 = dc.convert_from_xarray(SIMPLE_DATA_ARRAY)
46+
47+
# FIXME
48+
# xr_da1 = dc.convert_to_xarray(da_array1)

0 commit comments

Comments
 (0)