Skip to content

Add base test for ExtensionArray.__setitem__ #23300

Closed
@TomAugspurger

Description

@TomAugspurger

The tests in https://github.com/pandas-dev/pandas/blob/master/pandas/tests/extension/base/setitem.py seem to mainly operate on ExtensionArrays that are boxed in a Series.

It would be good to directly test ExtensionArray.setitem.

Some of these tests could be parametrized with something like

@pytest.fixture(params=[True, False])
def box(request):
    """Whether to box the data in a Series"""
    return request.param


def test_setitem_scalar_series(self, data, box):
    if box:
        data = pd.Series(data)
    data[0] = data[1
    assert arr[0] == data[1]

others may have to be written separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExtensionArrayExtending pandas with custom dtypes or arrays.Testingpandas testing functions or related to the test suitegood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions