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

Python tests.eq_函数代码示例

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

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



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

示例1: test_render_quoted_server_default

 def test_render_quoted_server_default(self):
     eq_(
         autogenerate._render_server_default(
             "nextval('group_to_perm_group_to_perm_id_seq'::regclass)",
                 self.autogen_context),
         '"nextval(\'group_to_perm_group_to_perm_id_seq\'::regclass)"'
     )
开发者ID:Lifto,项目名称:alembic,代码行数:7,代码来源:test_autogenerate.py


示例2: test_clear

 def test_clear(self):
     db = sqlsoup.SQLSoup(engine)
     eq_(db.loans.count(), 1)
     _ = db.loans.insert(book_id=1, user_name='Bhargan Basepair')
     db.expunge_all()
     db.flush()
     eq_(db.loans.count(), 1)
开发者ID:kenwilcox,项目名称:sqlsoup,代码行数:7,代码来源:test_sqlsoup.py


示例3: test_globlookup

    def test_globlookup(self):
        # Create temporary files equivalent to those used in test_strlookup
        tmp = mkdtemp()
        chars = ("a", "b", "c")
        for l1 in chars:
            os.mkdir(os.path.join(tmp, l1))
            for l2 in chars:
                os.mkdir(os.path.join(tmp, l1, l2))
                for l3 in chars:
                    f = os.path.join(tmp, l1, l2, l3)
                    with open(f, "w") as fh:
                        fh.write(f)

        # Test the lookup
        lookup = partial(globlookup, root=tmp)
        eq_(list(lookup("a/a/*")), ["a/a/a", "a/a/b", "a/a/c"])
        eq_(list(lookup("a/*/a")), ["a/a/a", "a/b/a", "a/c/a"])
        eq_(list(lookup("*/a/a")), ["a/a/a", "b/a/a", "c/a/a"])
        eq_(list(lookup("a/*")), [
            "a/a/a", "a/a/b", "a/a/c",
            "a/b/a", "a/b/b", "a/b/c",
            "a/c/a", "a/c/b", "a/c/c",
            ])

        # Test the lookup within set_evil
        eq_(set_evil("a/* = */a", lookup), set(["a/a/a", "a/b/a", "a/c/a"]))
开发者ID:icio,项目名称:evil,代码行数:26,代码来源:test_set.py


示例4: test_render_custom

    def test_render_custom(self):

        def render(type_, obj, context):
            if type_ == "foreign_key":
                return None
            if type_ == "column":
                if obj.name == "y":
                    return None
                else:
                    return "col(%s)" % obj.name
            return "render:%s" % type_

        autogen_context = {"opts": {
            'render_item': render,
            'alembic_module_prefix': 'sa.'
        }}

        t = Table('t', MetaData(),
                Column('x', Integer),
                Column('y', Integer),
                PrimaryKeyConstraint('x'),
                ForeignKeyConstraint(['x'], ['y'])
            )
        result = autogenerate._add_table(
                    t, autogen_context
                )
        eq_(
            result, """sa.create_table('t',
col(x),
render:primary_key\n)"""
        )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:31,代码来源:test_autogenerate.py


示例5: test_lookup_legacy

    def test_lookup_legacy(self):
        self.cfg.set_main_option("file_template", "%%(rev)s")
        script = ScriptDirectory.from_config(self.cfg)
        a = util.rev_id()
        script.generate_revision(a, None, refresh=True)
        write_script(
            script,
            a,
            """
    down_revision = None

    from alembic import op

    def upgrade():
        op.execute("CREATE TABLE foo(id integer)")

    def downgrade():
        op.execute("DROP TABLE foo")

    """,
        )

        script = ScriptDirectory.from_config(self.cfg)
        rev = script._get_rev(a)
        eq_(rev.revision, a)
        eq_(os.path.basename(rev.path), "%s.py" % a)
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:26,代码来源:test_versioning.py


示例6: test_set_evil_op_opposing

 def test_set_evil_op_opposing(self):
     try:
         set_evil("a > < b", lambda t: set(), self.left_right_ops())
     except SyntaxError as e:
         eq_(e.args[0], "Operators cannot be beside one another if they "
                        "act on expressions facing one-another.")
         set_evil("a <> <> b", lambda t: set(), self.left_right_ops())
开发者ID:icio,项目名称:evil,代码行数:7,代码来源:test_evil.py


示例7: test_option

    def test_option(self):
        self.cfg.set_main_option("file_template", "myfile_%%(slug)s")
        script = ScriptDirectory.from_config(self.cfg)
        a = util.rev_id()
        script.generate_revision(a, "some message", refresh=True)
        write_script(
            script,
            a,
            """
    revision = '%s'
    down_revision = None

    from alembic import op

    def upgrade():
        op.execute("CREATE TABLE foo(id integer)")

    def downgrade():
        op.execute("DROP TABLE foo")

    """
            % a,
        )

        script = ScriptDirectory.from_config(self.cfg)
        rev = script._get_rev(a)
        eq_(rev.revision, a)
        eq_(os.path.basename(rev.path), "myfile_some_message.py")
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:28,代码来源:test_versioning.py


示例8: test_args_propagate

 def test_args_propagate(self):
     config = _no_sql_testing_config()
     script = ScriptDirectory.from_config(config)
     template_args = {"x": "x1", "y": "y1", "z": "z1"}
     env = EnvironmentContext(config, script, template_args=template_args)
     env.configure(dialect_name="sqlite", template_args={"y": "y2", "q": "q1"})
     eq_(template_args, {"x": "x1", "y": "y2", "z": "z1", "q": "q1"})
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_revision_create.py


示例9: test_render_drop_table_w_schema

 def test_render_drop_table_w_schema(self):
     eq_(
         autogenerate._drop_table(
             Table("sometable", MetaData(), schema='foo'),
             self.autogen_context),
         "op.drop_table('sometable', schema='foo')"
     )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:7,代码来源:test_autogenerate.py


示例10: test_render_nothing

    def test_render_nothing(self):
        context = MigrationContext.configure(
            connection=self.bind.connect(),
            opts={
                'compare_type': True,
                'compare_server_default': True,
                'target_metadata': self.m1,
                'upgrade_token': "upgrades",
                'downgrade_token': "downgrades",
                'alembic_module_prefix': 'op.',
                'sqlalchemy_module_prefix': 'sa.',
            }
        )
        template_args = {}
        autogenerate._produce_migration_diffs(context, template_args, set(),
                include_symbol=lambda name, schema: False
            )
        eq_(re.sub(r"u'", "'", template_args['upgrades']),
"""### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###""")
        eq_(re.sub(r"u'", "'", template_args['downgrades']),
"""### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###""")
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:25,代码来源:test_autogenerate.py


示例11: test_xcpp_matlab

def test_xcpp_matlab():
    """[XCPP-MATLAB]: """
    exec_cmd('excentury xc_test.xcpp to matlab --force')
    cmd = 'matlab -nodisplay -nosplash'
    run_cmd("%s < matlab/xc_test.m > /dev/null" % cmd, "", "")
    data = load_file('tmp.xc')
    eq_(data['x'], 4, "Failed...")
    eq_(data['y'], 27, "Failed...")
开发者ID:jmlopez-rod,项目名称:excentury,代码行数:8,代码来源:test_xcpp.py


示例12: test_set_evil_op_right_missing

 def test_set_evil_op_right_missing(self):
     try:
         set_evil("a >", lambda t: set(), self.left_right_ops())
     except SyntaxError as e:
         eq_(e.args[0], "Operators which act on expressions to their "
                        "right or both sides cannot be at the end of "
                        "an expression.")
         raise e
开发者ID:icio,项目名称:evil,代码行数:8,代码来源:test_evil.py


示例13: test_set_evil_op_left_missing

 def test_set_evil_op_left_missing(self):
     try:
         set_evil("< b", lambda t: set(), self.left_right_ops())
     except TypeError as e:
         eq_(e.args[0], "Operators which act on expressions to their "
                        "left or both sides cannot be at the beginning "
                        "of an expression.")
         raise e
开发者ID:icio,项目名称:evil,代码行数:8,代码来源:test_evil.py


示例14: test_standalone_op

def test_standalone_op():
    eng, buf = capture_db()

    env = MigrationContext.configure(eng)
    op = Operations(env)

    op.alter_column("t", "c", nullable=True)
    eq_(buf, ['ALTER TABLE t ALTER COLUMN c DROP NOT NULL'])
开发者ID:Lifto,项目名称:alembic,代码行数:8,代码来源:test_config.py


示例15: test_config_no_file_section_option

def test_config_no_file_section_option():
    cfg = config.Config()
    cfg.set_section_option("foo", "url", "postgresql://foo/bar")

    eq_(cfg.get_section_option("foo", "url"), "postgresql://foo/bar")

    cfg.set_section_option("foo", "echo", "True")
    eq_(cfg.get_section_option("foo", "echo"), "True")
开发者ID:Lifto,项目名称:alembic,代码行数:8,代码来源:test_config.py


示例16: test_render_drop_column_w_schema

    def test_render_drop_column_w_schema(self):
        eq_(
            autogenerate._drop_column(
                    "foo", "bar", Column("x", Integer, server_default="5"),
                        self.autogen_context),

            "op.drop_column('bar', 'x', schema='foo')"
        )
开发者ID:shadowmint,项目名称:py-test-watcher,代码行数:8,代码来源:test_autogenerate.py


示例17: test_render_add_column

 def test_render_add_column(self):
     eq_(
         autogenerate._add_column(
                 "foo", Column("x", Integer, server_default="5"),
                     self.autogen_context),
         "op.add_column('foo', sa.Column('x', sa.Integer(), "
             "server_default='5', nullable=True))"
     )
开发者ID:Lifto,项目名称:alembic,代码行数:8,代码来源:test_autogenerate.py


示例18: test_render_drop_column

    def test_render_drop_column(self):
        eq_(
            autogenerate._drop_column(
                    "foo", Column("x", Integer, server_default="5"),
                        self.autogen_context),

            "op.drop_column('foo', 'x')"
        )
开发者ID:Lifto,项目名称:alembic,代码行数:8,代码来源:test_autogenerate.py


示例19: test_render_diffs

    def test_render_diffs(self):
        """test a full render including indentation"""

        metadata = self.m2
        template_args = {}
        autogenerate._produce_migration_diffs(self.context, template_args, set())
        eq_(re.sub(r"u'", "'", template_args['upgrades']),
"""### commands auto generated by Alembic - please adjust! ###
    op.create_table('item',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('description', sa.String(length=100), nullable=True),
    sa.Column('order_id', sa.Integer(), nullable=True),
    sa.CheckConstraint('len(description) > 5'),
    sa.ForeignKeyConstraint(['order_id'], ['order.order_id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('extra')
    op.add_column('address', sa.Column('street', sa.String(length=50), nullable=True))
    op.add_column('order', sa.Column('user_id', sa.Integer(), nullable=True))
    op.alter_column('order', 'amount',
               existing_type=sa.NUMERIC(precision=8, scale=2),
               type_=sa.Numeric(precision=10, scale=2),
               nullable=True,
               existing_server_default='0')
    op.drop_column('user', 'pw')
    op.alter_column('user', 'a1',
               existing_type=sa.TEXT(),
               server_default='x',
               existing_nullable=True)
    op.alter_column('user', 'name',
               existing_type=sa.VARCHAR(length=50),
               nullable=False)
    ### end Alembic commands ###""")
        eq_(re.sub(r"u'", "'", template_args['downgrades']),
"""### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user', 'name',
               existing_type=sa.VARCHAR(length=50),
               nullable=True)
    op.alter_column('user', 'a1',
               existing_type=sa.TEXT(),
               server_default=None,
               existing_nullable=True)
    op.add_column('user', sa.Column('pw', sa.VARCHAR(length=50), nullable=True))
    op.alter_column('order', 'amount',
               existing_type=sa.Numeric(precision=10, scale=2),
               type_=sa.NUMERIC(precision=8, scale=2),
               nullable=False,
               existing_server_default='0')
    op.drop_column('order', 'user_id')
    op.drop_column('address', 'street')
    op.create_table('extra',
    sa.Column('x', sa.CHAR(), nullable=True),
    sa.Column('uid', sa.INTEGER(), nullable=True),
    sa.ForeignKeyConstraint(['uid'], ['user.id'], ),
    sa.PrimaryKeyConstraint()
    )
    op.drop_table('item')
    ### end Alembic commands ###""")
开发者ID:Lifto,项目名称:alembic,代码行数:58,代码来源:test_autogenerate.py


示例20: test_cls_crud

 def test_cls_crud(self):
     db = sqlsoup.SQLSoup(engine)
     MappedUsers = db.users
     db.users.filter_by(name='Bhargan Basepair'
                        ).update(dict(name='Some New Name'))
     u1 = db.users.filter_by(name='Some New Name').one()
     eq_(u1, MappedUsers(name='Some New Name',
         email='basepa[email protected]', password='basepair',
         classname=None, admin=1))
开发者ID:kenwilcox,项目名称:sqlsoup,代码行数:9,代码来源:test_sqlsoup.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tests.expect函数代码示例发布时间:2022-05-27
下一篇:
Python tests.create_tokens_acl函数代码示例发布时间: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