def test_add_by_ufloat_and_int(self): test1 = ufloat(100, m) test2 = 1000 ans = test1 + test2 assert str(ans) == '1100.0 m'
def test_instance_add_by_ufloat_and_int(self): test1 = ufloat(100, m) test2 = 1000 ans = test1 + test2 assert isinstance(ans, ufloat)
def test_make_instance(self): test = ufloat(100, m) assert isinstance(test, ufloat)
def test_instance_add_by_ufloat_and_bool(self): test1 = ufloat(100, m) test2 = True ans = test1 + test2 assert isinstance(ans, ufloat)
def test_add_by_ufloat_and_bool(self): test1 = ufloat(100, m) test2 = True ans = test1 + test2 assert str(ans) == '101.0 m'
def test_str_func(self): test = ufloat(100.0, m) assert str(test) == '100.0 m'
def test_is_float_instance_by_str(self): test = ufloat('100', m) assert isinstance(test.x, float)
def test_is_float_instance_by_int(self): test = ufloat(100, m) assert isinstance(test.x, float)
def test_basicdiv(): assert(5/f.s == ufloat(5,{'s':-1})) assert(f.s/f.m == ufloat(1,{'s':1,'m':-1})) assert(f.s/f.s == 1) assert(a.s/a.m == UnitArray(1,{'s':1,'m':-1}))
def test_basicmul(): assert(5*f.s == ufloat(5,{'s':1})) assert(f.s*f.m == ufloat(1,{'s':1,'m':1})) assert(f.s*f.s == ufloat(1,{'s':2})) assert(a.s*a.m == UnitArray(1,{'s':1,'m':1}))