$23 GRAYBYTE WORDPRESS FILE MANAGER $96

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/testing/suite/

HOME
Current File : /opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/testing/suite//test_ddl.py
from .. import config
from .. import fixtures
from .. import util
from ..assertions import eq_
from ..config import requirements
from ... import Column
from ... import inspect
from ... import Integer
from ... import schema
from ... import String
from ... import Table


class TableDDLTest(fixtures.TestBase):
    __backend__ = True

    def _simple_fixture(self, schema=None):
        return Table(
            "test_table",
            self.metadata,
            Column("id", Integer, primary_key=True, autoincrement=False),
            Column("data", String(50)),
            schema=schema,
        )

    def _underscore_fixture(self):
        return Table(
            "_test_table",
            self.metadata,
            Column("id", Integer, primary_key=True, autoincrement=False),
            Column("_data", String(50)),
        )

    def _simple_roundtrip(self, table):
        with config.db.begin() as conn:
            conn.execute(table.insert().values((1, "some data")))
            result = conn.execute(table.select())
            eq_(result.first(), (1, "some data"))

    @requirements.create_table
    @util.provide_metadata
    def test_create_table(self):
        table = self._simple_fixture()
        table.create(config.db, checkfirst=False)
        self._simple_roundtrip(table)

    @requirements.create_table
    @util.provide_metadata
    def test_create_table_schema(self):
        table = self._simple_fixture(schema=config.test_schema)
        table.create(config.db, checkfirst=False)
        self._simple_roundtrip(table)

    @requirements.drop_table
    @util.provide_metadata
    def test_drop_table(self):
        table = self._simple_fixture()
        table.create(config.db, checkfirst=False)
        table.drop(config.db, checkfirst=False)

    @requirements.create_table
    @util.provide_metadata
    def test_underscore_names(self):
        table = self._underscore_fixture()
        table.create(config.db, checkfirst=False)
        self._simple_roundtrip(table)

    @requirements.comment_reflection
    @util.provide_metadata
    def test_add_table_comment(self):
        table = self._simple_fixture()
        table.create(config.db, checkfirst=False)
        table.comment = "a comment"
        config.db.execute(schema.SetTableComment(table))
        eq_(
            inspect(config.db).get_table_comment("test_table"),
            {"text": "a comment"},
        )

    @requirements.comment_reflection
    @util.provide_metadata
    def test_drop_table_comment(self):
        table = self._simple_fixture()
        table.create(config.db, checkfirst=False)
        table.comment = "a comment"
        config.db.execute(schema.SetTableComment(table))
        config.db.execute(schema.DropTableComment(table))
        eq_(inspect(config.db).get_table_comment("test_table"), {"text": None})


__all__ = ("TableDDLTest",)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 6.48 AM
root / 996
0755
__pycache__
--
31 Aug 2024 6.48 AM
root / 996
0755
__init__.py
0.35 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_cte.py
6.629 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_ddl.py
2.803 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_dialect.py
4.465 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_insert.py
9.361 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_reflection.py
36.59 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_results.py
11.234 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_select.py
19.516 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_sequence.py
4.552 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_types.py
28.938 KB
22 Jul 2019 3.36 AM
root / 996
0644
test_update_delete.py
1.443 KB
22 Jul 2019 3.36 AM
root / 996
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF