(self, elements, generator, argument, checkfirst)
| 479 | ) |
| 480 | |
| 481 | def _assert_create_tables(self, elements, generator, argument, checkfirst): |
| 482 | self._assert_ddl( |
| 483 | (schema.CreateTable, schema.CreateView), |
| 484 | elements, |
| 485 | generator, |
| 486 | argument, |
| 487 | ) |
| 488 | |
| 489 | tables = [] |
| 490 | if CheckFirst(checkfirst) & CheckFirst.TABLES: |
| 491 | if generator.tables is not None: |
| 492 | tables.extend([t for t in generator.tables if not t.is_view]) |
| 493 | elif isinstance(argument, MetaData): |
| 494 | tables.extend( |
| 495 | [t for t in argument.tables.values() if not t.is_view] |
| 496 | ) |
| 497 | else: |
| 498 | assert False, "don't know what tables we are checking" |
| 499 | |
| 500 | if CheckFirst(checkfirst) & CheckFirst.VIEWS: |
| 501 | if generator.tables is not None: |
| 502 | tables.extend([t for t in generator.tables if t.is_view]) |
| 503 | elif isinstance(argument, MetaData): |
| 504 | tables.extend( |
| 505 | [t for t in argument.tables.values() if t.is_view] |
| 506 | ) |
| 507 | else: |
| 508 | assert False, "don't know what views we are checking" |
| 509 | |
| 510 | if tables: |
| 511 | eq_( |
| 512 | generator.dialect.has_table.mock_calls, |
| 513 | [ |
| 514 | mock.call(mock.ANY, tablename, schema=mock.ANY) |
| 515 | for tablename in [t.name for t in tables] |
| 516 | ], |
| 517 | ) |
| 518 | else: |
| 519 | eq_( |
| 520 | generator.dialect.has_index.mock_calls, |
| 521 | [], |
| 522 | ) |
| 523 | |
| 524 | def _assert_drop_tables(self, elements, generator, argument, checkfirst): |
| 525 | self._assert_ddl( |
no test coverage detected