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

Python tools.assert_not_equal函数代码示例

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

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



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

示例1: test_posterior_transitions_w_training

def test_posterior_transitions_w_training():
	sequences = [ list(x) for x in ( 'A', 'ACT', 'GGCA', 'TACCTGT' ) ]
	indices = { state.name: i for i, state in enumerate( model.states ) }

	transitions = model.dense_transition_matrix()
	i0, i1, i2 = indices['I0'], indices['I1'], indices['I2']
	d1, d2, d3 = indices['D1'], indices['D2'], indices['D3']
	m1, m2, m3 = indices['M1'], indices['M2'], indices['M3']

	assert_equal( transitions[d1, i1], transitions[d2, i2] )
	assert_equal( transitions[i0, i0], transitions[i1, i1] )
	assert_equal( transitions[i0, i0], transitions[i2, i2] )
	assert_equal( transitions[i0, m1], transitions[i1, m2] )
	assert_equal( transitions[d1, d2], transitions[d2, d3] )
	assert_equal( transitions[i0, d1], transitions[i1, d2] )
	assert_equal( transitions[i0, d1], transitions[i2, d3] )

	model.train( sequences )
	transitions = model.dense_transition_matrix()

	assert_not_equal( transitions[d1, i1], transitions[d2, i2] )
	assert_not_equal( transitions[i0, m1], transitions[i1, m2] )
	assert_not_equal( transitions[d1, d2], transitions[d2, d3] )
	assert_not_equal( transitions[i0, d1], transitions[i1, d2] )
	assert_not_equal( transitions[i0, d1], transitions[i2, d3] )
开发者ID:Geoion,项目名称:pomegranate,代码行数:25,代码来源:test_profile_hmm.py


示例2: test_mx_lookup

def test_mx_lookup(ld, cmx):
    # has MX, has MX server
    ld.return_value = ['mx1.fake.mailgun.com', 'mx2.fake.mailgun.com']
    cmx.return_value = 'mx1.fake.mailgun.com'

    addr = address.validate_address('[email protected]')
    assert_not_equal(addr, None)

    # has fallback A, has MX server
    ld.return_value = ['domain.com']
    cmx.return_value = 'domain.com'

    addr = address.validate_address('[email protected]')
    assert_not_equal(addr, None)

    # has MX, no server answers
    ld.return_value = ['mx.example.com']
    cmx.return_value = None

    addr = address.validate_address('[email protected]')
    assert_equal(addr, None)

    # no MX
    ld.return_value = []
    cmx.return_value = None

    addr = address.validate_address('[email protected]')
    assert_equal(addr, None)
开发者ID:EthanBlackburn,项目名称:flanker,代码行数:28,代码来源:validator_test.py


示例3: test_customer_bank_accounts_create_new_idempotency_key_for_each_call

def test_customer_bank_accounts_create_new_idempotency_key_for_each_call():
    fixture = helpers.load_fixture('customer_bank_accounts')['create']
    helpers.stub_response(fixture)
    helpers.client.customer_bank_accounts.create(*fixture['url_params'])
    helpers.client.customer_bank_accounts.create(*fixture['url_params'])
    assert_not_equal(responses.calls[0].request.headers.get('Idempotency-Key'),
                     responses.calls[1].request.headers.get('Idempotency-Key'))
开发者ID:gocardless,项目名称:gocardless-pro-python,代码行数:7,代码来源:customer_bank_accounts_integration_test.py


示例4: test_fetch_adhd

def test_fetch_adhd():
    local_url = "file://" + tst.datadir

    sub1 = [3902469, 7774305, 3699991]
    sub2 = [2014113, 4275075, 1019436,
            3154996, 3884955, 27034,
            4134561, 27018, 6115230,
            27037, 8409791, 27011]
    sub3 = [3007585, 8697774, 9750701,
            10064, 21019, 10042,
            10128, 2497695, 4164316,
            1552181, 4046678, 23012]
    sub4 = [1679142, 1206380, 23008,
            4016887, 1418396, 2950754,
            3994098, 3520880, 1517058,
            9744150, 1562298, 3205761, 3624598]
    subs = np.array(sub1 + sub2 + sub3 + sub4, dtype='i8')
    subs = subs.view(dtype=[('Subject', 'i8')])
    tst.mock_fetch_files.add_csv(
        'ADHD200_40subs_motion_parameters_and_phenotypics.csv',
        subs)

    adhd = func.fetch_adhd(data_dir=tst.tmpdir, url=local_url,
                           n_subjects=12, verbose=0)
    assert_equal(len(adhd.func), 12)
    assert_equal(len(adhd.confounds), 12)
    assert_equal(len(tst.mock_url_request.urls), 13)  # Subjects + phenotypic
    assert_not_equal(adhd.description, '')
开发者ID:mrahim,项目名称:nilearn,代码行数:28,代码来源:test_func.py


示例5: test_get_collections

  def test_get_collections(self):
    resp = self.db.list_sentry_roles_by_group() # Non Sentry Admin can do that
    assert_not_equal(0, resp.status.value, resp)
    assert_true('denied' in resp.status.message, resp)

    resp = self.db.list_sentry_roles_by_group(groupName='*')
    assert_equal(0, resp.status.value, resp)
开发者ID:277800076,项目名称:hue,代码行数:7,代码来源:tests.py


示例6: test_001_is_runnable

    def test_001_is_runnable(self):
        """ Still running after we launch it.

        As authauth is a persistent server it should be still be running!"""
        time.sleep(1)
        assert_not_equal(self.process, None)
        assert_equal(self.process.poll(), None)
开发者ID:asimihsan,项目名称:listpile,代码行数:7,代码来源:test_model_basic.py


示例7: test_group

def test_group(module, EXAMPLE):
    assert_hasattr(module, 'Group')
    assert_is_instance(module.Group, type)

    shared = module.Shared.from_dict(EXAMPLE['shared'])
    values = EXAMPLE['values']
    for value in values:
        shared.add_value(value)

    group1 = module.Group()
    group1.init(shared)
    for value in values:
        group1.add_value(shared, value)
    group2 = module.Group.from_values(shared, values)
    assert_close(group1.dump(), group2.dump())

    group = module.Group.from_values(shared, values)
    dumped = group.dump()
    group.init(shared)
    group.load(dumped)
    assert_close(group.dump(), dumped)

    for value in values:
        group2.remove_value(shared, value)
    assert_not_equal(group1, group2)
    group2.merge(shared, group1)

    for value in values:
        group1.score_value(shared, value)
    for _ in xrange(10):
        value = group1.sample_value(shared)
        group1.score_value(shared, value)
        module.sample_group(shared, 10)
    group1.score_data(shared)
    group2.score_data(shared)
开发者ID:dlovell,项目名称:distributions,代码行数:35,代码来源:test_models.py


示例8: test_info

def test_info():
    "Check that Inspector.info fills out various fields as expected."
    i = inspector.info(Call, oname='Call')
    nt.assert_equal(i['type_name'], 'type')
    expted_class = str(type(type))  # <class 'type'> (Python 3) or <type 'type'>
    nt.assert_equal(i['base_class'], expted_class)
    nt.assert_regex(i['string_form'], "<class 'IPython.core.tests.test_oinspect.Call'( at 0x[0-9a-f]{1,9})?>")
    fname = __file__
    if fname.endswith(".pyc"):
        fname = fname[:-1]
    # case-insensitive comparison needed on some filesystems
    # e.g. Windows:
    nt.assert_equal(i['file'].lower(), compress_user(fname).lower())
    nt.assert_equal(i['definition'], None)
    nt.assert_equal(i['docstring'], Call.__doc__)
    nt.assert_equal(i['source'], None)
    nt.assert_true(i['isclass'])
    nt.assert_equal(i['init_definition'], "Call(x, y=1)")
    nt.assert_equal(i['init_docstring'], Call.__init__.__doc__)

    i = inspector.info(Call, detail_level=1)
    nt.assert_not_equal(i['source'], None)
    nt.assert_equal(i['docstring'], None)

    c = Call(1)
    c.__doc__ = "Modified instance docstring"
    i = inspector.info(c)
    nt.assert_equal(i['type_name'], 'Call')
    nt.assert_equal(i['docstring'], "Modified instance docstring")
    nt.assert_equal(i['class_docstring'], Call.__doc__)
    nt.assert_equal(i['init_docstring'], Call.__init__.__doc__)
    nt.assert_equal(i['call_docstring'], Call.__call__.__doc__)
开发者ID:PKpacheco,项目名称:monitor-dollar-value-galicia,代码行数:32,代码来源:test_oinspect.py


示例9: test_rev

    def test_rev(self):
        doc = self.create_document({})

        doc._rev = None

        assert_not_equal(doc._id, None)
        assert_equal(doc._rev, None)
开发者ID:aniljava,项目名称:arango-python,代码行数:7,代码来源:tests_document.py


示例10: test_outgoing_url

def test_outgoing_url():
    redirect_url = settings.REDIRECT_URL
    secretkey = settings.REDIRECT_SECRET_KEY
    exceptions = settings.REDIRECT_URL_WHITELIST
    settings.REDIRECT_URL = 'http://example.net'
    settings.REDIRECT_SECRET_KEY = 'sekrit'
    settings.REDIRECT_URL_WHITELIST = ['nicedomain.com']

    try:
        myurl = 'http://example.com'
        s = urlresolvers.get_outgoing_url(myurl)

        # Regular URLs must be escaped.
        eq_(s,
            'http://example.net/bc7d4bb262c9f0b0f6d3412ede7d3252c2e311bb1d55f6'
            '2315f636cb8a70913b/'
            'http%3A//example.com')

        # No double-escaping of outgoing URLs.
        s2 = urlresolvers.get_outgoing_url(s)
        eq_(s, s2)

        evil = settings.REDIRECT_URL.rstrip('/') + '.evildomain.com'
        s = urlresolvers.get_outgoing_url(evil)
        assert_not_equal(s, evil,
                         'No subdomain abuse of double-escaping protection.')

        nice = 'http://nicedomain.com/lets/go/go/go'
        eq_(nice, urlresolvers.get_outgoing_url(nice))

    finally:
        settings.REDIRECT_URL = redirect_url
        settings.REDIRECT_SECRET_KEY = secretkey
        settings.REDIRECT_URL_WHITELIST = exceptions
开发者ID:abdellah-bn,项目名称:olympia,代码行数:34,代码来源:test_url_prefix.py


示例11: test_allocate

    def test_allocate(self):
        self.block.from_list([0] * 100)
        assert_raises(InvalidArgumentError, self.block.allocate)
        assert_raises(InvalidArgumentError, self.block.allocate, None, 0)
        assert_raises(InvalidArgumentError, self.block.allocate, None, -1)
        assert_raises(InvalidArgumentError, self.block.allocate, None, -10)
        assert_raises(InvalidArgumentError, self.block.allocate, [], None)
        assert_raises(InvalidArgumentError, self.block.allocate, [1], 2)

        # Allocate an entire range
        self.block.deallocate((0, 49))
        assert_raises(NotEnoughUnallocatedSpaceError, self.block.allocate, None, 51)
        offset = self.block.allocate(size=50)
        assert_equal(offset, 0)
        assert_equal(self.block.unallocated_ranges, [])

        # Allocate the beginning of a range
        self.block.deallocate((10, 39))
        offset = self.block.allocate(data=[0x12, 0x34, 0xef])
        assert_equal(offset, 10)
        assert_equal(self.block.unallocated_ranges, [(13, 39)])
        assert_equal(self.block[offset:offset + 3].to_list(), [0x12, 0x34, 0xef])
        assert_not_equal(self.block.to_list(), [0] * 100)
        self.block[offset:offset + 3] = [0] * 3
        assert_equal(self.block.to_list(), [0] * 100)
开发者ID:LittleCube13,项目名称:CoilSnake,代码行数:25,代码来源:test_blocks.py


示例12: test_write_uncor

 def test_write_uncor(self):
     """ Testcase main """
     assert_equal(self.nvme_read(), 0)
     assert_equal(self.write_uncor(), 0)
     assert_not_equal(self.nvme_read(), 0)
     assert_equal(self.nvme_write(), 0)
     assert_equal(self.nvme_read(), 0)
开发者ID:YuanDdQiao,项目名称:nvme-cli,代码行数:7,代码来源:nvme_writeuncor_test.py


示例13: test_farsi_correction

def test_farsi_correction():
    """Verify that a Farsi sentence is corrected"""
    wrong = u"ابن یک جملهٔ آرمایسی است"
    right = u"این یک جملهٔ آزمایشی است"
    corrected = d.suggest(wrong)
    new = u" ".join([word.new for word in corrected])
    assert_not_equal(wrong, new)
开发者ID:pcraciunoiu,项目名称:didyoumean,代码行数:7,代码来源:test_basic_farsi.py


示例14: test_select

 def test_select(self):
     for db in settings.DATABASES:
         people = Employee.objects.db_manager(db).select()
         assert_not_equal(people.count(), 0)
         for p in people:
             ok_(p.first_name)
             ok_(p.last_name)
开发者ID:uranusjr,项目名称:django-mosql,代码行数:7,代码来源:tests.py


示例15: test2

def test2():
    datafile = resource_filename('sknano', 'data/nanotubes/1010_1cell.data')
    atoms = DATAData(fpath=datafile).atoms
    atoms.assign_unique_ids()
    atoms.update_attrs()
    assert_not_equal(atoms.Natoms, 20)
    assert_equal(atoms.Natoms, 40)
开发者ID:chr7stos,项目名称:scikit-nano,代码行数:7,代码来源:test_lammps_data_format.py


示例16: test_configure_get

 def test_configure_get(self):
     response = self.app.get('/metrics/configure/BytesAdded')
     assert_not_equal(
         response.data.find('name="positive_only_sum"'),
         -1,
         'A form to configure a BytesAdded metric was not rendered'
     )
开发者ID:c4ssio,项目名称:analytics-wikimetrics,代码行数:7,代码来源:test_metrics.py


示例17: test_gaussian_random_seed

def test_gaussian_random_seed():

    genson.set_global_seed(42)

    gson = \
    """
    {
        "gaussian_random_seed" : gaussian(0, 1, draws=2)
    }
    """
    gen = genson.loads(gson)
    vals = [val['gaussian_random_seed'] for val in gen]
    assert_equal(vals[0], 0.4967141530112327)
    assert_equal(vals[1], -0.13826430117118466)

    genson.set_global_seed(None)
    gen.reset()
    vals = [val['gaussian_random_seed'] for val in gen]
    assert_not_equal(vals[0], 0.4967141530112327)
    assert_not_equal(vals[1], -0.13826430117118466)

    genson.set_global_seed(42)
    gen.reset()
    gen = genson.loads(gson)
    vals = [val['gaussian_random_seed'] for val in gen]
    assert_equal(vals[0], 0.4967141530112327)
    assert_equal(vals[1], -0.13826430117118466)
开发者ID:jaberg,项目名称:genson,代码行数:27,代码来源:test_random_seed.py


示例18: test_simple_stochastic_synapse

def test_simple_stochastic_synapse(sim, plot_figure=False):
    # in this test we connect
    sim.setup(min_delay=0.5)
    t_stop = 1000.0
    spike_times = np.arange(2.5, t_stop, 5.0)
    source = sim.Population(1, sim.SpikeSourceArray(spike_times=spike_times))
    neurons = sim.Population(4, sim.IF_cond_exp(tau_syn_E=1.0))
    synapse_type = sim.SimpleStochasticSynapse(weight=0.5,
                                               p=np.array([[0.0, 0.5, 0.5, 1.0]]))
    connections = sim.Projection(source, neurons, sim.AllToAllConnector(),
                                 synapse_type=synapse_type)
    source.record('spikes')
    neurons.record('gsyn_exc')
    sim.run(t_stop)

    data = neurons.get_data().segments[0]
    gsyn = data.analogsignals[0].rescale('uS')
    if plot_figure:
        import matplotlib.pyplot as plt
        for i in range(neurons.size):
            plt.subplot(neurons.size, 1, i+1)
            plt.plot(gsyn.times, gsyn[:, i])
        plt.savefig("test_simple_stochastic_synapse_%s.png" % sim.__name__)
    print(data.analogsignals[0].units)
    crossings = []
    for i in range(neurons.size):
        crossings.append(
                gsyn.times[:-1][np.logical_and(gsyn.magnitude[:-1, i] < 0.4, 0.4 < gsyn.magnitude[1:, i])])
    assert_equal(crossings[0].size, 0)
    assert_less(crossings[1].size, 0.6*spike_times.size)
    assert_greater(crossings[1].size, 0.4*spike_times.size)
    assert_equal(crossings[3].size, spike_times.size)
    assert_not_equal(crossings[1], crossings[2])
    print(crossings[1].size / spike_times.size)
    return data
开发者ID:antolikjan,项目名称:PyNN,代码行数:35,代码来源:test_synapse_types.py


示例19: test_limit_documents

    def test_limit_documents(self):
        c = self.conn.collection
        c.test.create()

        c.test.docs.create({"doc": 1})
        c.test.docs.create({"doc": 2})

        assert_not_equal(
            self.conn.collection.test.documents().count,
            1
        )

        assert_equal(
            len(self.conn.collection.test.documents()),
            self.conn.collection.test.documents().count
        )

        assert_equal(
            len(self.conn.collection.test.documents().limit(1)),
            1
        )

        assert_equal(
            len(self.conn.collection.test
                .documents()
                .offset(2)
                .limit(1)),
            0)
开发者ID:aniljava,项目名称:arango-python,代码行数:28,代码来源:tests_collection_integration.py


示例20: step_impl

def step_impl(context, data):
    if data == 'new':
        assert_not_equal(context.page_data, context.page.get_all_page_data())
    elif data == 'previous':
        assert_equal(context.old_page_data, context.page.get_all_page_data())
    else:
        raise Exception('Unknown data')
开发者ID:ShinKaiRyuu,项目名称:Testing-MBA-SB,代码行数:7,代码来源:client_reporting_steps.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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