MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / test_bulk_insert

Method test_bulk_insert

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

Source from the content-addressed store, hash-verified

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