MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _assert_drop_tables

Method _assert_drop_tables

test/sql/test_ddlemit.py:524–562  ·  view source on GitHub ↗
(self, elements, generator, argument, checkfirst)

Source from the content-addressed store, hash-verified

522 )
523
524 def _assert_drop_tables(self, elements, generator, argument, checkfirst):
525 self._assert_ddl(
526 (schema.DropTable, schema.DropView), elements, generator, argument
527 )
528
529 tables = []
530 if CheckFirst(checkfirst) & CheckFirst.TABLES:
531 if generator.tables is not None:
532 tables.extend([t for t in generator.tables if not t.is_view])
533 elif isinstance(argument, MetaData):
534 tables.extend(
535 [t for t in argument.tables.values() if not t.is_view]
536 )
537 else:
538 assert False, "don't know what tables we are checking"
539
540 if CheckFirst(checkfirst) & CheckFirst.VIEWS:
541 if generator.tables is not None:
542 tables.extend([t for t in generator.tables if t.is_view])
543 elif isinstance(argument, MetaData):
544 tables.extend(
545 [t for t in argument.tables.values() if t.is_view]
546 )
547 else:
548 assert False, "don't know what views we are checking"
549
550 if tables:
551 eq_(
552 generator.dialect.has_table.mock_calls,
553 [
554 mock.call(mock.ANY, tablename, schema=mock.ANY)
555 for tablename in [t.name for t in tables]
556 ],
557 )
558 else:
559 eq_(
560 generator.dialect.has_index.mock_calls,
561 [],
562 )
563
564 def _assert_create(self, elements, generator, argument):
565 self._assert_ddl(

Calls 5

_assert_ddlMethod · 0.95
CheckFirstClass · 0.90
eq_Function · 0.90
extendMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected