# Two AI-written regression tests for pandas category membership

On 1 December 2026, two separate hosted OpenAI Codex sessions using GPT-6.2-sol each wrote a membership test. We kept their first responses and ran the functions unchanged against pandas 3.1.1 and 3.1.2. The sessions received different briefs after the fix was public. Both test files import pandas as `pd`.

| Membership brief | pandas 3.1.1 | pandas 3.1.2 |
| --- | --- | --- |
| Feature named | Passed | Passed |
| Edge condition named | Failed on `assert 10 in index` | Passed |

## The feature-named brief

> Membership of an ordered categorical index of integers.

The generated test supplied its categories as a list. All five assertions passed on both releases.

```python
def test_membership():
    index = pd.CategoricalIndex(
        [20, 10, 20], categories=[30, 20, 10], ordered=True
    )

    assert 10 in index
    assert 20 in index
    assert 30 not in index  # Declared category with no occurrence.
    assert 40 not in index
    assert "20" not in index
```

## The edge-informed brief

> Membership of an ordered categorical index of integers. An integer range supplies the categories. A lookup for the first observed label should succeed.

The generated test supplied its categories as a range. On 3.1.1, looking up 10 returned false even though 10 appeared in the input. The same assertion passed on 3.1.2.

```python
def test_membership():
    index = pd.CategoricalIndex(
        [10, 12, 14], categories=range(10, 15), ordered=True
    )

    assert 10 in index
```

## Inspect the evidence or repeat the check

The interactive guide uses a separate four-ID reference experiment written by the researchers. Its copyable pytest case is a template for the IDs you select. The two functions above come from the frozen model responses.

[Download the full study](https://cueapril.com/downloads/agentic-testing-2027-study.zip). Inside, `model/plain.txt` and `model/named.txt` contain the complete prompts. `model/general_tests.py` and `model/risk_named_tests.py` contain the full responses. The files `evidence/generated-3.1.1.json` and `evidence/generated-3.1.2.json` record the result of every function.

To repeat the study, extract it and run `sh replay.sh` in the extracted study directory with uv available. It installs the pinned dependencies in two environments and runs the saved suites and reference checks. [Research report and methodology](https://cueapril.com/guides/agentic-testing-2027) · [Upstream pandas fix](https://github.com/pandas-dev/pandas/pull/72262).
