'Check that multiplication/division with other quantities is only
possible when the physical unit is dimensionless, and that this turns
the result into a normal quantity.'

def test_multiplication_division(self):

    lq = u.Magnitude((np.arange(1.0, 11.0) * u.Jy))
    with pytest.raises(u.UnitsError):
        (lq * (1.0 * u.m))
    with pytest.raises(u.UnitsError):
        ((1.0 * u.m) * lq)
    with pytest.raises(u.UnitsError):
        (lq / lq)
    for unit in (u.m, u.mag, u.dex):
        with pytest.raises(u.UnitsError):
            (lq / unit)
    lq2 = u.Magnitude(np.arange(1, 11.0))
    with pytest.raises(u.UnitsError):
        (lq2 * lq)
    with pytest.raises(u.UnitsError):
        (lq2 / lq)
    with pytest.raises(u.UnitsError):
        (lq / lq2)
    r = (lq2 / u.Magnitude(2.0))
    assert (r.unit == u.dimensionless_unscaled)
    assert np.all((r.value == (lq2.value / 2.0)))
    tf = (lq2 * u.m)
    tr = (u.m * lq2)
    for t in (tf, tr):
        assert (not isinstance(t, type(lq2)))
        assert (t.unit == (lq2.unit.function_unit * u.m))
        with u.set_enabled_equivalencies(u.logarithmic()):
            with pytest.raises(u.UnitsError):
                t.to(lq2.unit.physical_unit)
    t = (tf / (50.0 * u.cm))
    assert t.unit.is_equivalent(lq2.unit.function_unit)
    assert_allclose(t.to(lq2.unit.function_unit), (lq2._function_view * 2))
