MCPcopy Index your code
hub / github.com/PyMySQL/PyMySQL / test_bulk_insert

Method test_bulk_insert

pymysql/tests/test_basic.py:362–379  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

360 self.assertEqual(sorted(data), sorted(result))
361
362 def test_bulk_insert(self):
363 conn = self.connect()
364 cursor = conn.cursor()
365
366 data = [(0, "bob", 21, 123), (1, "jim", 56, 45), (2, "fred", 100, 180)]
367 cursor.executemany(
368 "insert into bulkinsert (id, name, age, height) values (%s,%s,%s,%s)",
369 data,
370 )
371 self.assertEqual(
372 cursor._executed,
373 bytearray(
374 b"insert into bulkinsert (id, name, age, height) values "
375 b"(0,'bob',21,123),(1,'jim',56,45),(2,'fred',100,180)"
376 ),
377 )
378 cursor.execute("commit")
379 self._verify_records(data)
380
381 def test_bulk_insert_multiline_statement(self):
382 conn = self.connect()

Callers

nothing calls this directly

Calls 5

_verify_recordsMethod · 0.95
cursorMethod · 0.80
executemanyMethod · 0.80
executeMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected