示例#1
0
 def test_get_units(self):
     r"""Test get_units."""
     for v in self._vars_nounits:
         self.assert_equal(units.get_units(v), '')
     for v in self._vars_units:
         self.assert_equal(units.get_units(v),
                           str(units.as_unit('cm').units))
示例#2
0
 def test_as_unit(self):
     r"""Test as_unit."""
     units.as_unit('cm')
     self.assert_raises(ValueError, units.as_unit, 'invalid')
示例#3
0
 def test_as_unit(self):
     r"""Test as_unit."""
     units.as_unit('cm')
     with pytest.raises(ValueError):
         units.as_unit('invalid')
示例#4
0
 def test_get_units(self, vars_units, vars_nounits):
     r"""Test get_units."""
     for v in vars_nounits:
         assert (units.get_units(v) == '')
     for v in vars_units:
         assert (units.get_units(v) == str(units.as_unit('cm').units))