MCPcopy
hub / github.com/pandas-dev/pandas / test_error

Function test_error

pandas/tests/frame/methods/test_explode.py:10–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9
10def test_error():
11 df = pd.DataFrame(
12 {"A": pd.Series([[0, 1, 2], np.nan, [], (3, 4)], index=list("abcd")), "B": 1}
13 )
14 with pytest.raises(
15 ValueError, match="column must be a scalar, tuple, or list thereof"
16 ):
17 df.explode([list("AA")])
18
19 with pytest.raises(ValueError, match="column must be unique"):
20 df.explode(list("AA"))
21
22 df.columns = list("AA")
23 with pytest.raises(
24 ValueError,
25 match=re.escape("DataFrame columns must be unique. Duplicate columns: ['A']"),
26 ):
27 df.explode("A")
28
29
30@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

explodeMethod · 0.95
raisesMethod · 0.45

Tested by

no test coverage detected