8
8
from xarray .coding import strings
9
9
from xarray .core import indexing
10
10
11
- from . import IndexerMaker , assert_array_equal , assert_identical , requires_dask
11
+ from . import (
12
+ IndexerMaker ,
13
+ assert_array_equal ,
14
+ assert_identical ,
15
+ requires_dask ,
16
+ requires_netCDF4 ,
17
+ )
12
18
13
19
with suppress (ImportError ):
14
20
import dask .array as da
@@ -30,19 +36,20 @@ def test_vlen_dtype():
30
36
assert strings .check_vlen_dtype (np .dtype (object )) is None
31
37
32
38
33
- @pytest .mark .parametrize ("numpy_str_type " , (np . str , np .str_ ))
34
- def test_numpy_str_handling (numpy_str_type ):
35
- dtype = strings .create_vlen_dtype (numpy_str_type )
36
- assert dtype .metadata ["element_type" ] == numpy_str_type
39
+ @pytest .mark .parametrize ("str_type " , (str , np .str_ ))
40
+ def test_numpy_str_handling (str_type ):
41
+ dtype = strings .create_vlen_dtype (str_type )
42
+ assert dtype .metadata ["element_type" ] == str_type
37
43
assert strings .is_unicode_dtype (dtype )
38
44
assert not strings .is_bytes_dtype (dtype )
39
- assert strings .check_vlen_dtype (dtype ) is numpy_str_type
45
+ assert strings .check_vlen_dtype (dtype ) is str_type
40
46
41
47
42
- @pytest .mark .parametrize ("numpy_str_type" , (np .str , np .str_ ))
43
- def test_write_file_from_np_str (numpy_str_type ):
48
+ @requires_netCDF4
49
+ @pytest .mark .parametrize ("str_type" , (str , np .str_ ))
50
+ def test_write_file_from_np_str (str_type ):
44
51
# should be moved elsewhere probably
45
- scenarios = [numpy_str_type (v ) for v in ["scenario_a" , "scenario_b" , "scenario_c" ]]
52
+ scenarios = [str_type (v ) for v in ["scenario_a" , "scenario_b" , "scenario_c" ]]
46
53
years = range (2015 , 2100 + 1 )
47
54
tdf = pd .DataFrame (
48
55
data = np .random .random ((len (scenarios ), len (years ))),
0 commit comments