(self)
| 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() |
nothing calls this directly
no test coverage detected