MCPcopy
hub / github.com/geldata/gel / test_sql_dml_insert_13

Method test_sql_dml_insert_13

tests/test_sql_dml.py:302–336  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

300 self.assertEqual(first[2], 'meeting report (new)')
301
302 async def test_sql_dml_insert_13(self):
303 # returning sublink
304 await self.scon.execute('INSERT INTO "User" DEFAULT VALUES;')
305 await self.scon.execute(
306 '''
307 INSERT INTO "Document" (title, owner_id)
308 SELECT 'Report', id FROM "User" LIMIT 1
309 '''
310 )
311
312 res = await self.squery_values(
313 '''
314 INSERT INTO "Document" as subject (title, owner_id)
315 VALUES ('Report', NULL), ('Briefing', (SELECT id FROM "User"))
316 RETURNING (
317 SELECT COUNT(*) FROM "User" WHERE "User".id = owner_id
318 ),
319 (
320 SELECT COUNT(*) FROM "User"
321 ),
322 (
323 SELECT COUNT(*) FROM "Document" AS d
324 WHERE subject.title = d.title
325 )
326 '''
327 )
328 self.assertEqual(
329 res,
330 tb.bag(
331 [
332 [0, 1, 1],
333 [1, 1, 0],
334 ]
335 ),
336 )
337
338 async def test_sql_dml_insert_14(self):
339 with self.assertRaisesRegex(

Callers

nothing calls this directly

Calls 2

executeMethod · 0.80
squery_valuesMethod · 0.80

Tested by

no test coverage detected