1
1
import pytest
2
2
3
+ from bmi_tester .api import WITH_GIMLI_UNITS
3
4
from bmi_tester .api import check_unit_is_dimensionless
4
5
from bmi_tester .api import check_unit_is_time
5
6
from bmi_tester .api import check_unit_is_valid
6
7
7
8
9
+ @pytest .mark .skipif (not WITH_GIMLI_UNITS , reason = "gimli.units is not installed" )
8
10
@pytest .mark .parametrize (
9
11
"unit" , ("m" , "m / s" , "m s-1" , "N m" , "N.m" , "m^2" , "m2" , "" , "1" )
10
12
)
11
13
def test_check_valid_units (unit ):
12
14
assert check_unit_is_valid (unit )
13
15
14
16
17
+ @pytest .mark .skipif (not WITH_GIMLI_UNITS , reason = "gimli.units is not installed" )
15
18
@pytest .mark .parametrize ("unit" , ("foo" , "m ** 2" , "-" ))
16
19
def test_check_invalid_units (unit ):
17
20
assert not check_unit_is_valid (unit )
18
21
19
22
23
+ @pytest .mark .skipif (not WITH_GIMLI_UNITS , reason = "gimli.units is not installed" )
20
24
@pytest .mark .parametrize ("unit" , ("" , "1" ))
21
25
def test_dimensionless_units (unit ):
22
26
assert check_unit_is_dimensionless (unit )
23
27
24
28
29
+ @pytest .mark .skipif (not WITH_GIMLI_UNITS , reason = "gimli.units is not installed" )
25
30
def test_not_dimensionless_units ():
26
31
assert not check_unit_is_dimensionless ("m" )
27
32
28
33
34
+ @pytest .mark .skipif (not WITH_GIMLI_UNITS , reason = "gimli.units is not installed" )
29
35
@pytest .mark .parametrize (
30
36
"unit" ,
31
37
(
@@ -42,5 +48,6 @@ def test_time_units(unit):
42
48
assert check_unit_is_time (unit )
43
49
44
50
51
+ @pytest .mark .skipif (not WITH_GIMLI_UNITS , reason = "gimli.units is not installed" )
45
52
def test_not_time_units ():
46
53
assert not check_unit_is_time ("m" )
0 commit comments