'Check that inplace operations check properly for casting.
First two tests that check that float32 is kept close #3976.'

def test_ufunc_inplace_non_standard_dtype(self):

    a1 = u.Quantity([1, 2, 3, 4], u.m, dtype=np.float32)
    a1 *= np.float32(10)
    assert (a1.unit is u.m)
    assert (a1.dtype == np.float32)
    a2 = u.Quantity([1, 2, 3, 4], u.m, dtype=np.float32)
    a2 += (20.0 * u.km)
    assert (a2.unit is u.m)
    assert (a2.dtype == np.float32)
    a3 = u.Quantity([1, 2, 3, 4], u.m, dtype=np.int32)
    a3 += u.Quantity(10, u.m, dtype=np.int64)
    assert (a3.unit is u.m)
    assert (a3.dtype == np.int32)
    a4 = u.Quantity([1, 2, 3, 4], u.m, dtype=np.int32)
    with pytest.raises(TypeError):
        a4 += u.Quantity(10, u.mm, dtype=np.int64)
