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

Python tools.assert_is_instance函数代码示例

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

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



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

示例1: assert_frame

def assert_frame(s):
    """ Check that s is a valid frame.
    
    """
    assert_is_instance(s, Frame)
    assert s._kb == ec
    assert s.test_frame()
开发者ID:ebogart,项目名称:PyCyc,代码行数:7,代码来源:test_pathwaytools_interface.py


示例2: test_retrun

def test_retrun():
    p = return_statement()
    node, r = p('return 5')

    eq_(r, '')
    assert_is_instance(node, Return)
    eq_(node.result, NumericLiteral('5'))
开发者ID:bbonf,项目名称:matcha,代码行数:7,代码来源:__init__.py


示例3: test_slice_types

    def test_slice_types(self):

        h = HaplotypeArray(haplotype_data, dtype='i1')

        # row slice
        s = h[1:]
        assert_is_instance(s, HaplotypeArray)

        # col slice
        s = h[:, 1:]
        assert_is_instance(s, HaplotypeArray)

        # row index
        s = h[0]
        assert_is_instance(s, np.ndarray)
        assert_not_is_instance(s, HaplotypeArray)

        # col index
        s = h[:, 0]
        assert_is_instance(s, np.ndarray)
        assert_not_is_instance(s, HaplotypeArray)

        # item
        s = h[0, 0]
        assert_is_instance(s, np.int8)
        assert_not_is_instance(s, HaplotypeArray)
开发者ID:hardingnj,项目名称:scikit-allel,代码行数:26,代码来源:test_model_ndarray.py


示例4: test_self_axes

    def test_self_axes(self):

        g = ag.FacetGrid(self.df, row="a", col="b", hue="c")
        for ax in g.axes.flat:
            nt.assert_is_instance(ax, plt.Axes)

        plt.close("all")
开发者ID:c-wilson,项目名称:seaborn,代码行数:7,代码来源:test_axisgrid.py


示例5: test_value

def test_value(module, EXAMPLE):
    assert_hasattr(module, 'Value')
    assert_is_instance(module.Value, type)

    values = EXAMPLE['values']
    for value in values:
        assert_is_instance(value, module.Value)
开发者ID:dlovell,项目名称:distributions,代码行数:7,代码来源:test_models.py


示例6: test_list

def test_list():
    lis = [lambda x: x, 1]
    bufs = serialize_object(lis)
    canned = pickle.loads(bufs[0])
    nt.assert_is_instance(canned, list)
    l2, r = unserialize_object(bufs)
    nt.assert_equal(l2[0](l2[1]), lis[0](lis[1]))
开发者ID:pyarnold,项目名称:ipython,代码行数:7,代码来源:test_serialize.py


示例7: check_basic_figure_sanity

    def check_basic_figure_sanity(self, fig, exp_num_subplots, exp_title,
                                  exp_legend_exists, exp_xlabel, exp_ylabel,
                                  exp_zlabel):
        # check type
        assert_is_instance(fig, mpl.figure.Figure)

        # check number of subplots
        axes = fig.get_axes()
        npt.assert_equal(len(axes), exp_num_subplots)

        # check title
        ax = axes[0]
        npt.assert_equal(ax.get_title(), exp_title)

        # shouldn't have tick labels
        for tick_label in (ax.get_xticklabels() + ax.get_yticklabels() +
                           ax.get_zticklabels()):
            npt.assert_equal(tick_label.get_text(), '')

        # check if legend is present
        legend = ax.get_legend()
        if exp_legend_exists:
            assert_true(legend is not None)
        else:
            assert_true(legend is None)

        # check axis labels
        npt.assert_equal(ax.get_xlabel(), exp_xlabel)
        npt.assert_equal(ax.get_ylabel(), exp_ylabel)
        npt.assert_equal(ax.get_zlabel(), exp_zlabel)
开发者ID:7924102,项目名称:scikit-bio,代码行数:30,代码来源:test_ordination.py


示例8: test_mandates_list

def test_mandates_list():
    fixture = helpers.load_fixture('mandates')['list']
    helpers.stub_response(fixture)
    response = helpers.client.mandates.list(*fixture['url_params'])
    body = fixture['body']['mandates']

    assert_is_instance(response, list_response.ListResponse)
    assert_is_instance(response.records[0], resources.Mandate)

    assert_equal(response.before, fixture['body']['meta']['cursors']['before'])
    assert_equal(response.after, fixture['body']['meta']['cursors']['after'])

    assert_equal([r.created_at for r in response.records],
                 [b.get('created_at') for b in body])
    assert_equal([r.id for r in response.records],
                 [b.get('id') for b in body])
    assert_equal([r.metadata for r in response.records],
                 [b.get('metadata') for b in body])
    assert_equal([r.next_possible_charge_date for r in response.records],
                 [b.get('next_possible_charge_date') for b in body])
    assert_equal([r.reference for r in response.records],
                 [b.get('reference') for b in body])
    assert_equal([r.scheme for r in response.records],
                 [b.get('scheme') for b in body])
    assert_equal([r.status for r in response.records],
                 [b.get('status') for b in body])
开发者ID:idlead,项目名称:gocardless-pro-python,代码行数:26,代码来源:mandates_integration_test.py


示例9: test_exif_property

    def test_exif_property(self):
        assert_is_instance(self.p.exif, exif)

        def _set():
            self.p.exif = None

        assert_raises(AttributeError, _set)
开发者ID:Yuego,项目名称:d3-convert,代码行数:7,代码来源:test_photo.py


示例10: test_resource_definition_via_dict

def test_resource_definition_via_dict():
    """Test programmatic resource definition (as opposed to reading a config file)."""
    cfg = gc3libs.config.Configuration()
    # define resource
    name = 'test'
    cfg.resources[name].update(
        name=name,
        type='shellcmd',
        auth='none',
        transport='local',
        max_cores_per_job=1,
        max_memory_per_core=1*GB,
        max_walltime=8*hours,
        max_cores=2,
        architecture=Run.Arch.X86_64,
    )
    # make it
    resources = cfg.make_resources(ignore_errors=False)
    # check result
    resource = resources[name]
    assert_equal(resource.name, name)
    assert_is_instance(resource,
                       gc3libs.backends.shellcmd.ShellcmdLrms)
    assert_is_instance(resource.transport,
                       gc3libs.backends.transport.LocalTransport)
    assert_equal(resource.max_cores_per_job, 1)
    assert_equal(resource.max_memory_per_core, 1*GB)
    assert_equal(resource.max_walltime, 8*hours)
    assert_equal(resource.max_cores, 2)
    assert_equal(resource.architecture, Run.Arch.X86_64)
开发者ID:arcimboldo,项目名称:gc3pie,代码行数:30,代码来源:test_config.py


示例11: test_subscriptions_create

def test_subscriptions_create():
    fixture = helpers.load_fixture('subscriptions')['create']
    helpers.stub_response(fixture)
    response = helpers.client.subscriptions.create(*fixture['url_params'])
    body = fixture['body']['subscriptions']

    assert_is_instance(response, resources.Subscription)

    assert_equal(response.amount, body.get('amount'))
    assert_equal(response.count, body.get('count'))
    assert_equal(response.created_at, body.get('created_at'))
    assert_equal(response.currency, body.get('currency'))
    assert_equal(response.day_of_month, body.get('day_of_month'))
    assert_equal(response.end_date, body.get('end_date'))
    assert_equal(response.id, body.get('id'))
    assert_equal(response.interval, body.get('interval'))
    assert_equal(response.interval_unit, body.get('interval_unit'))
    assert_equal(response.metadata, body.get('metadata'))
    assert_equal(response.month, body.get('month'))
    assert_equal(response.name, body.get('name'))
    assert_equal(response.payment_reference, body.get('payment_reference'))
    assert_equal(response.start_date, body.get('start_date'))
    assert_equal(response.status, body.get('status'))
    assert_equal(response.upcoming_payments, body.get('upcoming_payments'))
    assert_equal(response.links.mandate,
                 body.get('links')['mandate'])
开发者ID:idlead,项目名称:gocardless-pro-python,代码行数:26,代码来源:subscriptions_integration_test.py


示例12: test_additional_backend

def test_additional_backend():
    """Test instanciating a non-std backend."""
    tmpfile = _setup_config_file("""
[resource/test]
type = noop
auth = none
transport = local
max_cores_per_job = 1
max_memory_per_core = 1
max_walltime = 8
max_cores = 2
architecture = x86_64
    """)
    try:
        cfg = gc3libs.config.Configuration(tmpfile)
        cfg.TYPE_CONSTRUCTOR_MAP['noop'] = ('gc3libs.backends.noop', 'NoOpLrms')
        resources = cfg.make_resources(ignore_errors=False)
        # resources are enabled by default
        assert 'test' in resources
        from gc3libs.backends.noop import NoOpLrms
        assert_is_instance(resources['test'], NoOpLrms)
        # test types
    finally:
        # since TYPE_CONSTRUCTOR_MAP is a class-level variable, we
        # need to clean up otherwise other tests will see the No-Op
        # backend
        del cfg.TYPE_CONSTRUCTOR_MAP['noop']
        os.remove(tmpfile)
开发者ID:arcimboldo,项目名称:gc3pie,代码行数:28,代码来源:test_config.py


示例13: test_get_item

def test_get_item(td, raw):
    nt.assert_is_instance(td, JSONMapping)
    nt.assert_equal(td['a'], 1)
    nt.assert_equal(td['b'], JSONSequence(raw['b']))
    nt.assert_equal(td['b'][0], 1)
    nt.assert_equal(td['c'], JSONMapping(raw['c']))
    nt.assert_equal(td['c']['bb'][-1], 3)
开发者ID:kszucs,项目名称:stolos,代码行数:7,代码来源:test_json_config.py


示例14: test_csr_signing

 def test_csr_signing(self):
     pkey = ca.private_key()
     req = ca.csr(pkey, CN="App", O="Ezbake", OU="Ezbake Apps", C="US")
     cert = self.get_client(5049).csr(self.get_token(), ca.pem_csr(req))
     cert = crypto.load_certificate(crypto.FILETYPE_PEM, cert)
     nt.assert_is_instance(cert, crypto.X509)
     nt.assert_equal(req.get_subject(), cert.get_subject())
开发者ID:ezbake,项目名称:ezbake-ca,代码行数:7,代码来源:test_caservice.py


示例15: test_families

def test_families():
    families = table.families()
    for name, fdesc in families.iteritems():
        assert_is_instance(name, basestring)
        assert_is_instance(fdesc, dict)
        assert_in('name', fdesc)
        assert_in('max_versions', fdesc)
开发者ID:abeusher,项目名称:happybase,代码行数:7,代码来源:test_api.py


示例16: test_default_data_property_ro

    def test_default_data_property_ro(self):
        assert_is_instance(self.p.data, Maker)

        def _set():
            self.p.data = None

        assert_raises(AttributeError, _set)
开发者ID:Yuego,项目名称:d3-convert,代码行数:7,代码来源:test_photo.py


示例17: test_tuple

def test_tuple():
    tup = (lambda x: x, 1)
    bufs = serialize_object(tup)
    canned = pickle.loads(bufs[0])
    nt.assert_is_instance(canned, tuple)
    t2, r = unserialize_object(bufs)
    nt.assert_equal(t2[0](t2[1]), tup[0](tup[1]))
开发者ID:pyarnold,项目名称:ipython,代码行数:7,代码来源:test_serialize.py


示例18: test_get_class_name

 def test_get_class_name(self):
     name = Introspection.get_class_name(DummyClass())
     assert_is_instance(name, str)
     assert_equals(name, 'dummyclass')
     name = Introspection.get_class_name(DummyClass)
     assert_is_instance(name, str)
     assert_equals(name, 'dummyclass')
开发者ID:heyglen,项目名称:ghstore,代码行数:7,代码来源:test_introspection.py


示例19: test_sequence_config

def test_sequence_config():
    # Test sequence config.
    conf = SequenceConfig(sequence_class=Sequence)
    conf.sequence_name = 'test'
    assert_true(conf.config_ready)
    seq = conf.build_sequence()
    assert_is_instance(seq, Sequence)
开发者ID:PhilipVinc,项目名称:HQCMeas,代码行数:7,代码来源:test_base_config.py


示例20: test_create_core_default

def test_create_core_default():
    """Test `create_core` with factory defaults."""
    with temporary_config_file() as cfgfile:
        # std factory params
        core = create_core(cfgfile.name)
        assert_is_instance(core, Core)
        assert_equal(core.auto_enable_auth, True)
开发者ID:fliem,项目名称:gc3pie,代码行数:7,代码来源:test_core.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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