/
githubmirror
/
ydb-sqlalchemy
Обзор
Документация
Войти
/
githubmirror
/
ydb-sqlalchemy
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.0.1b21
test/test_inspect.py
34 строки
1 KB
Roman Tretiak
Add isort
25 янв 2024, 20:15
25 янв 2024, 20:15
389acc7
Код
Авторство
О чём код?
import sqlalchemy as sa from sqlalchemy import Column, Integer, Numeric, Table, Unicode from sqlalchemy.testing.fixtures import TablesTest class TestInspection(TablesTest): @classmethod def define_tables(cls, metadata): Table( "test", metadata, Column("id", Integer, primary_key=True, nullable=False), Column("value", Unicode), Column("num", Numeric(22, 9)), ) def test_get_columns(self, connection): inspect = sa.inspect(connection) columns = inspect.get_columns("test") for c in columns: c["type"] = type(c["type"]) assert columns == [ {"name": "id", "type": sa.INTEGER, "nullable": False, "default": None}, {"name": "value", "type": sa.TEXT, "nullable": True, "default": None}, {"name": "num", "type": sa.DECIMAL, "nullable": True, "default": None}, ] def test_has_table(self, connection): inspect = sa.inspect(connection) assert inspect.has_table("test") assert not inspect.has_table("foo")