当前位置: 首页>>代码示例>>Python>>正文


Python tests.eq_函数代码示例

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


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


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