'Test that if an explicit dtype is given, it is used, while if not,
numbers are converted to float (including decimal.Decimal, which
numpy converts to an object; closes #1419)'

def test_preserve_dtype(self):

    q1 = u.Quantity(12, unit=(u.m / u.s), dtype=int)
    assert (q1.dtype == int)
    q2 = u.Quantity(q1)
    assert (q2.dtype == float)
    assert (q2.value == float(q1.value))
    assert (q2.unit == q1.unit)
    a3 = np.array([1.0, 2.0], dtype=np.float32)
    q3 = u.Quantity(a3, u.yr)
    assert (q3.dtype == a3.dtype)
    q4 = u.Quantity(decimal.Decimal(u'10.25'), u.m)
    assert (q4.dtype == float)
    q5 = u.Quantity(decimal.Decimal(u'10.25'), u.m, dtype=object)
    assert (q5.dtype == object)
