(self, type_)
| 376 | |
| 377 | @testing.combinations("legacy", "statement") |
| 378 | def test_bulk_insert_heterogeneous(self, type_): |
| 379 | Edge, Point = (self.classes.Edge, self.classes.Point) |
| 380 | Graph = self.classes.Graph |
| 381 | |
| 382 | sess = self._fixture() |
| 383 | |
| 384 | graph = Graph(id=2) |
| 385 | sess.add(graph) |
| 386 | sess.flush() |
| 387 | graph_id = 2 |
| 388 | |
| 389 | d1 = [ |
| 390 | { |
| 391 | "start": Point(random.randint(1, 50), random.randint(1, 50)), |
| 392 | "end": Point(random.randint(1, 50), random.randint(1, 50)), |
| 393 | "graph_id": graph_id, |
| 394 | } |
| 395 | for i in range(3) |
| 396 | ] |
| 397 | d2 = [ |
| 398 | { |
| 399 | "start": Point(random.randint(1, 50), random.randint(1, 50)), |
| 400 | "graph_id": graph_id, |
| 401 | } |
| 402 | for i in range(2) |
| 403 | ] |
| 404 | d3 = [ |
| 405 | { |
| 406 | "x2": random.randint(1, 50), |
| 407 | "y2": random.randint(1, 50), |
| 408 | "graph_id": graph_id, |
| 409 | } |
| 410 | for i in range(2) |
| 411 | ] |
| 412 | data = d1 + d2 + d3 |
| 413 | random.shuffle(data) |
| 414 | |
| 415 | assert_data = [ |
| 416 | { |
| 417 | "start": d["start"] if "start" in d else None, |
| 418 | "end": ( |
| 419 | d["end"] |
| 420 | if "end" in d |
| 421 | else Point(d["x2"], d["y2"]) if "x2" in d else None |
| 422 | ), |
| 423 | "graph_id": d["graph_id"], |
| 424 | } |
| 425 | for d in data |
| 426 | ] |
| 427 | |
| 428 | if type_ == "statement": |
| 429 | sess.execute(insert(Edge), data) |
| 430 | elif type_ == "legacy": |
| 431 | sess.bulk_insert_mappings(Edge, data) |
| 432 | else: |
| 433 | assert False |
| 434 | |
| 435 | edges = self.tables.edges |
nothing calls this directly
no test coverage detected