MCPcopy Create free account
hub / github.com/zzzeek/sqlalchemy / test_fixture_randomizing

Method test_fixture_randomizing

test/sql/test_insert_exec.py:1293–1317  ·  view source on GitHub ↗
(self, connection, metadata)

Source from the content-addressed store, hash-verified

1291
1292 @testing.requires.insertmanyvalues
1293 def test_fixture_randomizing(self, connection, metadata):
1294 t = Table(
1295 "t",
1296 metadata,
1297 Column("id", Integer, Identity(), primary_key=True),
1298 Column("data", String(50)),
1299 )
1300 metadata.create_all(connection)
1301
1302 insertmanyvalues_fixture(connection, randomize_rows=True)
1303
1304 results = set()
1305
1306 for i in range(15):
1307 result = connection.execute(
1308 insert(t).returning(t.c.data, sort_by_parameter_order=False),
1309 [{"data": "d1"}, {"data": "d2"}, {"data": "d3"}],
1310 )
1311
1312 hashed_result = tuple(result.all())
1313 results.add(hashed_result)
1314 if len(results) > 1:
1315 return
1316 else:
1317 assert False, "got same order every time for 15 tries"
1318
1319 @testing.only_on("postgresql>=13")
1320 @testing.variation("downgrade", [True, False])

Callers

nothing calls this directly

Calls 11

TableClass · 0.90
ColumnClass · 0.90
IdentityClass · 0.90
StringClass · 0.90
insertmanyvalues_fixtureFunction · 0.90
insertFunction · 0.90
create_allMethod · 0.80
executeMethod · 0.45
returningMethod · 0.45
allMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected