| 376 | # TODO: why not in the sqlite suite? |
| 377 | @testing.only_on("sqlite+pysqlite") |
| 378 | def test_lastrowid_zero(self, metadata, connection): |
| 379 | from sqlalchemy.dialects import sqlite |
| 380 | |
| 381 | class ExcCtx(sqlite.base.SQLiteExecutionContext): |
| 382 | def get_lastrowid(self): |
| 383 | return 0 |
| 384 | |
| 385 | t = Table( |
| 386 | "t", |
| 387 | self.metadata, |
| 388 | Column("x", Integer, primary_key=True), |
| 389 | Column("y", Integer), |
| 390 | implicit_returning=False, |
| 391 | ) |
| 392 | t.create(connection) |
| 393 | with mock.patch.object( |
| 394 | connection.dialect, "execution_ctx_cls", ExcCtx |
| 395 | ): |
| 396 | r = connection.execute(t.insert().values(y=5)) |
| 397 | eq_(r.inserted_primary_key, (0,)) |
| 398 | |
| 399 | @testing.requires.supports_autoincrement_w_composite_pk |
| 400 | def test_misordered_lastrow(self, connection, metadata): |