def test_schema_single_meta(self):
        Base = declarative_base()

        class A(Base):
            __tablename__ = 'A'
            id = Column(Integer, primary_key=True)

        class B(Base):
            __tablename__ = 'B'
            id = Column(Integer, primary_key=True)

        engine = create_engine('sqlite://')
        cli = Sqla(orm.sessionmaker(bind=engine), metadata=Base.metadata)

        output = StringIO()
        with mock.patch.object(sys, 'stdout', output):
            cli.command_schema()
        created = self._created_tables(output.getvalue())
        self.assertEqual(len(created), 2)
        self.assertEqual(created.count('A'), 1)
        self.assertEqual(created.count('B'), 1)

        output = StringIO()
        with mock.patch.object(sys, 'stdout', output):
            cli.command_schema('A')
        created = self._created_tables(output.getvalue())
        self.assertEqual(created, ['A'])

        output = StringIO()
        with mock.patch.object(sys, 'stdout', output):
            try:
                cli.command_schema('C')
            except __HOLE__:
                pass
        created = self._created_tables(output.getvalue())
        self.assertEqual(created, [])
dataset/ETHPy150Open SmartTeleMax/iktomi/tests/cli/sqla.py/SqlaTests.test_schema_single_meta