File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ Testing units with pint and UDUNITS2
3
+ """
4
+ import pytest
5
+
6
+ from .test_imports import gsw_base
7
+ from gsw_xarray ._attributes import _func_attrs
8
+
9
+ from pint import UnitRegistry
10
+ ureg = UnitRegistry ()
11
+
12
+ @pytest .mark .parametrize ("func_name" , gsw_base )
13
+ def test_unit_pint (func_name ):
14
+ if func_name in ["indexer" , "match_args_return" , "pchip_interp" ]:
15
+ # Internal gsw cookery or non wrapped functions
16
+ return
17
+ if func_name == 'geostrophic_velocity' :
18
+ pytest .xfail ('geostrophic_velocity outputs "degree_north" and "degree_east" that are not compatible with pint' )
19
+ attrs = _func_attrs [func_name ]
20
+ if isinstance (attrs , dict ):
21
+ attrs = [attrs ,]
22
+ for a in attrs :
23
+ print (a ['units' ])
24
+ ureg .Unit (a ['units' ])
You can’t perform that action at this time.
0 commit comments