def test_label_name_with_unit(): var = sc.Variable(['x'], values=np.random.random(10), unit=sc.units.counts) assert su.name_with_unit(var, name='sample') == 'sample [counts]'
def test_label_name_only(): assert su.name_with_unit(name='My name') == 'My name'
def test_label_var_with_unit_with_log(): var = sc.Variable(['x'], values=np.random.random(10), unit=sc.units.m) assert su.name_with_unit(var, log=True) == 'log\u2081\u2080(x) [m]'
def test_label_var_no_unit(): var = sc.Variable(['x'], values=np.random.random(10)) assert su.name_with_unit(var) == 'x [dimensionless]'
def test_label_var_with_unit(): var = sc.Variable(['x'], values=np.random.random(10), unit=sc.units.m) assert su.name_with_unit(var) == 'x [m]'