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

Function test_api_to_sql_fail

pandas/tests/io/test_sql.py:1632–1643  ·  view source on GitHub ↗
(conn, request, test_frame1)

Source from the content-addressed store, hash-verified

1630
1631@pytest.mark.parametrize("conn", all_connectable)
1632def test_api_to_sql_fail(conn, request, test_frame1):
1633 conn = request.getfixturevalue(conn)
1634 if sql.has_table("test_frame2", conn):
1635 with sql.SQLDatabase(conn, need_transaction=True) as pandasSQL:
1636 pandasSQL.drop_table("test_frame2")
1637
1638 sql.to_sql(test_frame1, "test_frame2", conn, if_exists="fail")
1639 assert sql.has_table("test_frame2", conn)
1640
1641 msg = "Table 'test_frame2' already exists"
1642 with pytest.raises(ValueError, match=msg):
1643 sql.to_sql(test_frame1, "test_frame2", conn, if_exists="fail")
1644
1645
1646@pytest.mark.parametrize("conn", all_connectable)

Callers

nothing calls this directly

Calls 4

has_tableMethod · 0.45
drop_tableMethod · 0.45
to_sqlMethod · 0.45
raisesMethod · 0.45

Tested by

no test coverage detected