• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tests.op_fixture函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.op_fixture函数的典型用法代码示例。如果您正苦于以下问题:Python op_fixture函数的具体用法?Python op_fixture怎么用?Python op_fixture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了op_fixture函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_alter_column_schema_schema_type_existing_type_no_const

def test_alter_column_schema_schema_type_existing_type_no_const():
    context = op_fixture('postgresql')
    op.alter_column("t", "c", type_=String(10), existing_type=Boolean(),
            schema='foo')
    context.assert_(
        'ALTER TABLE foo.t ALTER COLUMN c TYPE VARCHAR(10)'
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例2: test_alter_column_nullable_w_new_type

 def test_alter_column_nullable_w_new_type(self):
     context = op_fixture('oracle')
     op.alter_column("t", "c", nullable=True, type_=Integer)
     context.assert_(
         "ALTER TABLE t MODIFY c NULL",
         'ALTER TABLE t MODIFY c INTEGER'
     )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_oracle.py


示例3: test_rename_column_serv_default

def test_rename_column_serv_default():
    context = op_fixture('mysql')
    op.alter_column('t1', 'c1', new_column_name="c2", existing_type=Integer,
                        existing_server_default="q")
    context.assert_(
        "ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL DEFAULT 'q'"
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_mysql.py


示例4: test_alter_column_schema_schema_type_existing_type_no_new_type

def test_alter_column_schema_schema_type_existing_type_no_new_type():
    context = op_fixture('postgresql')
    op.alter_column("t", "c", nullable=False, existing_type=Boolean(),
            schema='foo')
    context.assert_(
        'ALTER TABLE foo.t ALTER COLUMN c SET NOT NULL'
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例5: test_add_column_fk_self_referential

def test_add_column_fk_self_referential():
    context = op_fixture()
    op.add_column('t1', Column('c1', Integer, ForeignKey('t1.c2'), nullable=False))
    context.assert_(
        "ALTER TABLE t1 ADD COLUMN c1 INTEGER NOT NULL",
        "ALTER TABLE t1 ADD FOREIGN KEY(c1) REFERENCES t1 (c2)"
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例6: test_add_column_fk_schema

def test_add_column_fk_schema():
    context = op_fixture()
    op.add_column('t1', Column('c1', Integer, ForeignKey('remote.t2.c2'), nullable=False))
    context.assert_(
    'ALTER TABLE t1 ADD COLUMN c1 INTEGER NOT NULL',
    'ALTER TABLE t1 ADD FOREIGN KEY(c1) REFERENCES remote.t2 (c2)'
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例7: test_drop_check

def test_drop_check():
    context = op_fixture('mysql')
    assert_raises_message(
        NotImplementedError,
        "MySQL does not support CHECK constraints.",
        op.drop_constraint, "f1", "t1", "check"
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_mysql.py


示例8: test_alter_column_dont_touch_constraints

 def test_alter_column_dont_touch_constraints(self):
     context = op_fixture('mssql')
     from sqlalchemy import Boolean
     op.alter_column('tests', 'col',
         existing_type=Boolean(),
         nullable=False)
     context.assert_('ALTER TABLE tests ALTER COLUMN col BIT NOT NULL')
开发者ID:Lifto,项目名称:alembic,代码行数:7,代码来源:test_mssql.py


示例9: test_col_add_autoincrement

def test_col_add_autoincrement():
    context = op_fixture('mysql')
    op.alter_column('t1', 'c1', new_column_name="c2", existing_type=Integer,
                                autoincrement=True)
    context.assert_(
        'ALTER TABLE t1 CHANGE c1 c2 INTEGER NULL AUTO_INCREMENT'
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_mysql.py


示例10: test_add_foreign_key_self_referential

def test_add_foreign_key_self_referential():
    context = op_fixture()
    op.create_foreign_key("fk_test", "t1", "t1", ["foo"], ["bar"])
    context.assert_(
        "ALTER TABLE t1 ADD CONSTRAINT fk_test "
        "FOREIGN KEY(foo) REFERENCES t1 (bar)"
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例11: test_add_column_fk

def test_add_column_fk():
    context = op_fixture()
    op.add_column('t1', Column('c1', Integer, ForeignKey('c2.id'), nullable=False))
    context.assert_(
        "ALTER TABLE t1 ADD COLUMN c1 INTEGER NOT NULL",
        "ALTER TABLE t1 ADD FOREIGN KEY(c1) REFERENCES c2 (id)"
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例12: test_create_index_table_col_event

def test_create_index_table_col_event():
    context = op_fixture()

    op.create_index('ik_test', 'tbl_with_auto_appended_column', ['foo', 'bar'])
    context.assert_(
        "CREATE INDEX ik_test ON tbl_with_auto_appended_column (foo, bar)"
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例13: test_col_alter_type_required

def test_col_alter_type_required():
    context = op_fixture('mysql')
    assert_raises_message(
        util.CommandError,
        "All MySQL ALTER COLUMN operations require the existing type.",
        op.alter_column, 't1', 'c1', nullable=False, server_default="q"
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_mysql.py


示例14: test_alter_column_schema_type_existing_type

def test_alter_column_schema_type_existing_type():
    context = op_fixture('mssql')
    op.alter_column("t", "c", type_=String(10), existing_type=Boolean(name="xyz"))
    context.assert_(
        'ALTER TABLE t DROP CONSTRAINT xyz',
        'ALTER TABLE t ALTER COLUMN c VARCHAR(10)'
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例15: test_alter_replace_server_default

 def test_alter_replace_server_default(self):
     context = op_fixture('mssql')
     op.alter_column("t", "c", server_default="5", existing_server_default="6")
     context.assert_contains("exec('alter table t drop constraint ' + @const_name)")
     context.assert_contains(
         "ALTER TABLE t ADD DEFAULT '5' FOR c"
     )
开发者ID:Lifto,项目名称:alembic,代码行数:7,代码来源:test_mssql.py


示例16: test_alter_column_schema_schema_type_named

def test_alter_column_schema_schema_type_named():
    context = op_fixture('mssql')
    op.alter_column("t", "c", type_=Boolean(name="xyz"), schema='foo')
    context.assert_(
        'ALTER TABLE foo.t ALTER COLUMN c BIT',
        'ALTER TABLE foo.t ADD CONSTRAINT xyz CHECK (c IN (0, 1))'
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例17: test_alter_column_schema_type_unnamed

def test_alter_column_schema_type_unnamed():
    context = op_fixture('mssql')
    op.alter_column("t", "c", type_=Boolean())
    context.assert_(
        'ALTER TABLE t ALTER COLUMN c BIT',
        'ALTER TABLE t ADD CHECK (c IN (0, 1))'
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例18: test_alter_column_set_compiled_default

def test_alter_column_set_compiled_default():
    context = op_fixture()
    op.alter_column("t", "c",
            server_default=func.utc_thing(func.current_timestamp()))
    context.assert_(
        "ALTER TABLE t ALTER COLUMN c SET DEFAULT utc_thing(CURRENT_TIMESTAMP)"
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_op.py


示例19: test_add_column_schema_type_checks_rule

def test_add_column_schema_type_checks_rule():
    """Test that a schema type doesn't generate a
    constraint based on check rule."""
    context = op_fixture('postgresql')
    op.add_column('t1', Column('c1', Boolean, nullable=False))
    context.assert_(
        'ALTER TABLE t1 ADD COLUMN c1 BOOLEAN NOT NULL',
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:8,代码来源:test_op.py


示例20: test_add_column_schema_schema_type

def test_add_column_schema_schema_type():
    """Test that a schema type generates its constraints...."""
    context = op_fixture()
    op.add_column('t1', Column('c1', Boolean, nullable=False), schema='foo')
    context.assert_(
        'ALTER TABLE foo.t1 ADD COLUMN c1 BOOLEAN NOT NULL',
        'ALTER TABLE foo.t1 ADD CHECK (c1 IN (0, 1))'
    )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:8,代码来源:test_op.py



注:本文中的tests.op_fixture函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tests.path_to_data_dir函数代码示例发布时间:2022-05-27
下一篇:
Python tests.new_notebook函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap