(
self,
metadata,
connection,
warn_for_downgrades,
randomize_returning,
sort_by_parameter_order,
sequence_type: testing.Variation,
increment: testing.Variation,
explicit_sentinel,
)
| 1370 | @testing.variation("increment", ["positive", "negative", "implicit"]) |
| 1371 | @testing.variation("explicit_sentinel", [True, False]) |
| 1372 | def test_invalid_identities( |
| 1373 | self, |
| 1374 | metadata, |
| 1375 | connection, |
| 1376 | warn_for_downgrades, |
| 1377 | randomize_returning, |
| 1378 | sort_by_parameter_order, |
| 1379 | sequence_type: testing.Variation, |
| 1380 | increment: testing.Variation, |
| 1381 | explicit_sentinel, |
| 1382 | ): |
| 1383 | if sequence_type.sequence: |
| 1384 | seq_cls = functools.partial(Sequence, name="t1_id_seq") |
| 1385 | elif sequence_type.identity: |
| 1386 | seq_cls = Identity |
| 1387 | else: |
| 1388 | sequence_type.fail() |
| 1389 | |
| 1390 | if increment.implicit: |
| 1391 | sequence = seq_cls(start=1) |
| 1392 | elif increment.positive: |
| 1393 | sequence = seq_cls(start=1, increment=1) |
| 1394 | elif increment.negative: |
| 1395 | sequence = seq_cls(start=-1, increment=-1) |
| 1396 | else: |
| 1397 | increment.fail() |
| 1398 | |
| 1399 | t1 = Table( |
| 1400 | "t1", |
| 1401 | metadata, |
| 1402 | Column( |
| 1403 | "id", |
| 1404 | Integer, |
| 1405 | sequence, |
| 1406 | primary_key=True, |
| 1407 | insert_sentinel=bool(explicit_sentinel), |
| 1408 | ), |
| 1409 | Column("data", String(50)), |
| 1410 | ) |
| 1411 | metadata.create_all(connection) |
| 1412 | |
| 1413 | fixtures.insertmanyvalues_fixture( |
| 1414 | connection, |
| 1415 | randomize_rows=bool(randomize_returning), |
| 1416 | warn_on_downgraded=bool(warn_for_downgrades), |
| 1417 | ) |
| 1418 | |
| 1419 | stmt = insert(t1).returning( |
| 1420 | t1.c.id, |
| 1421 | t1.c.data, |
| 1422 | sort_by_parameter_order=bool(sort_by_parameter_order), |
| 1423 | ) |
| 1424 | data = [{"data": f"d{i}"} for i in range(10)] |
| 1425 | |
| 1426 | use_imv = testing.db.dialect.use_insertmanyvalues |
| 1427 | if ( |
| 1428 | use_imv |
| 1429 | and increment.negative |
nothing calls this directly
no test coverage detected