def _assert_almost_equal_convert(value, u1, u2, ref): assert_almost_equal(units.convert(value, u1, u2), ref, err_msg="Conversion {0} --> {1} failed".format(u1, u2))
def test_unit_unconvertable(self): nm = 12.34567 A = nm * 10. with pytest.raises(ValueError): units.convert(A, 'A', 'ps')
def test_unit_unknown(self, quantity, unit1, unit2): with pytest.raises(ValueError): units.convert(quantity, unit1, unit2)