@pytest.mark.parametrize('val,exp_dtype', [(np.int32(1), np.int8), (np.int16((2 ** 9)), np.int16)])
def test_setitem_series_int8(self, val, exp_dtype, request):
    obj = pd.Series([1, 2, 3, 4], dtype=np.int8)
    assert (obj.dtype == np.int8)
    if (exp_dtype is np.int16):
        exp = pd.Series([1, 0, 3, 4], dtype=np.int8)
        self._assert_setitem_series_conversion(obj, val, exp, np.int8)
        mark = pytest.mark.xfail(reason='BUG: it must be pd.Series([1, 1, 3, 4], dtype=np.int16')
        request.node.add_marker(mark)
    warn = (None if (exp_dtype is np.int8) else FutureWarning)
    msg = 'Values are too large to be losslessly cast to int8'
    with tm.assert_produces_warning(warn, match=msg):
        exp = pd.Series([1, val, 3, 4], dtype=np.int8)
    self._assert_setitem_series_conversion(obj, val, exp, exp_dtype)
@pytest.mark.parametrize('val,exp_dtype', [(np.int32(1), np.int8), (np.int16((2 ** 9)), np.int16)])
def test_setitem_series_int8(self, val, exp_dtype, request):
    obj = pd.Series([1, 2, 3, 4], dtype=np.int8)
    assert (obj.dtype == np.int8)
    if (exp_dtype is np.int16):
        exp = pd.Series([1, 0, 3, 4], dtype=np.int8)
        self._assert_setitem_series_conversion(obj, val, exp, np.int8)
        mark = pytest.mark.xfail(reason='BUG: it must be pd.Series([1, 1, 3, 4], dtype=np.int16')
        request.node.add_marker(mark)
    warn = (None if (exp_dtype is np.int8) else FutureWarning)
    msg = 'Values are too large to be losslessly cast to int8'
    with tm.assert_produces_warning(warn, match=msg):
        exp = pd.Series([1, val, 3, 4], dtype=np.int8)
    self._assert_setitem_series_conversion(obj, val, exp, exp_dtype)