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

Python tools.assert_is_none函数代码示例

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

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



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

示例1: test_require_all

def test_require_all():
    class DefaultInit(ValueObject):
        id = Int()
        name = Unicode()

    obj = DefaultInit(1, "Dale")
    obj = DefaultInit(name="Dale", id=1)

    with nt.assert_raises(InvalidInitInvocation):
        obj = DefaultInit()

    class Loose(ValueObject):
        __require_all__ = False
        id = Int()
        name = Unicode()

    obj = Loose(1)
    nt.assert_equal(obj.id, 1)
    nt.assert_is_none(obj.name)

    # still strict mutation
    with nt.assert_raises(IllegalMutation):
        obj.id = 3

    # still won't accept extra args
    with nt.assert_raises(InvalidInitInvocation):
        Loose(1, "DALE", 123)

    # no error
    Loose()
开发者ID:dalejung,项目名称:hansel,代码行数:30,代码来源:test_value_object.py


示例2: test_get_engine

 def test_get_engine(self):
     self.ip.connected = False
     e = self.ip.get_engine()
     nt.assert_is_none(e)
     self.ip.connected = True
     e = self.ip.get_engine()
     nt.assert_equal(self.sa_engine, e)
开发者ID:jaysw,项目名称:ipydb,代码行数:7,代码来源:test_plugin.py


示例3: test_customer_bank_accounts_list

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

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

    assert_equal(response.before, fixture['body']['meta']['cursors']['before'])
    assert_equal(response.after, fixture['body']['meta']['cursors']['after'])
    assert_is_none(responses.calls[-1].request.headers.get('Idempotency-Key'))
    assert_equal([r.account_holder_name for r in response.records],
                 [b.get('account_holder_name') for b in body])
    assert_equal([r.account_number_ending for r in response.records],
                 [b.get('account_number_ending') for b in body])
    assert_equal([r.bank_name for r in response.records],
                 [b.get('bank_name') for b in body])
    assert_equal([r.country_code for r in response.records],
                 [b.get('country_code') for b in body])
    assert_equal([r.created_at for r in response.records],
                 [b.get('created_at') for b in body])
    assert_equal([r.currency for r in response.records],
                 [b.get('currency') for b in body])
    assert_equal([r.enabled for r in response.records],
                 [b.get('enabled') 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])
开发者ID:gocardless,项目名称:gocardless-pro-python,代码行数:30,代码来源:customer_bank_accounts_integration_test.py


示例4: test_snapshot

def test_snapshot():
    with tmp_db('snapshot') as db:
        db.put(b'a', b'a')
        db.put(b'b', b'b')

        # Snapshot should have existing values, but not changed values
        snapshot = db.snapshot()
        assert_equal(b'a', snapshot.get(b'a'))
        assert_list_equal(
            [b'a', b'b'],
            list(snapshot.iterator(include_value=False)))
        assert_is_none(snapshot.get(b'c'))
        db.delete(b'a')
        db.put(b'c', b'c')
        assert_is_none(snapshot.get(b'c'))
        assert_list_equal(
            [b'a', b'b'],
            list(snapshot.iterator(include_value=False)))

        # New snapshot should reflect latest state
        snapshot = db.snapshot()
        assert_equal(b'c', snapshot.get(b'c'))
        assert_list_equal(
            [b'b', b'c'],
            list(snapshot.iterator(include_value=False)))

        # Snapshots are directly iterable, just like DB
        assert_list_equal(
            [b'b', b'c'],
            list(k for k, v in snapshot))
开发者ID:ecdsa,项目名称:plyvel,代码行数:30,代码来源:test_plyvel.py


示例5: test_get_site_notification_impressions_over

 def test_get_site_notification_impressions_over(self, request, response, SiteNotification):
     note = SiteNotification.current.return_value
     note._id = 'deadbeef'
     note.impressions = 2
     request.cookies = {'site-notification': 'deadbeef-3-false'}
     assert_is_none(ThemeProvider().get_site_notification())
     assert not response.set_cookie.called
开发者ID:apache,项目名称:incubator-allura,代码行数:7,代码来源:test_plugin.py


示例6: 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_is_none(responses.calls[-1].request.headers.get('Idempotency-Key'))
    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.payments_require_approval for r in response.records],
                 [b.get('payments_require_approval') 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:gocardless,项目名称:gocardless-pro-python,代码行数:28,代码来源:mandates_integration_test.py


示例7: test_get_next_candidate

    def test_get_next_candidate(self):
        """
        Tests the get next candidate function.
        Tests:
            - The candidate's parameters are acceptable
        """

        cand = None
        counter = 0
        while cand is None and counter < 20:
            cand = self.EAss.get_next_candidate()
            time.sleep(0.1)
            counter += 1
        if counter == 20:
            raise Exception("Received no result in the first 2 seconds.")
        assert_is_none(cand.result)
        params = cand.params
        assert_less_equal(params["x"], 1)
        assert_greater_equal(params["x"], 0)
        assert_in(params["name"], self.param_defs["name"].values)
        self.EAss.update(cand, "pausing")
        time.sleep(1)
        new_cand = None
        while new_cand is None and counter < 20:
            new_cand = self.EAss.get_next_candidate()
            time.sleep(0.1)
            counter += 1
        if counter == 20:
            raise Exception("Received no result in the first 2 seconds.")
        assert_equal(new_cand, cand)
开发者ID:simudream,项目名称:apsis,代码行数:30,代码来源:test_experiment_assistant.py


示例8: test_LockingQueue_put_get

def test_LockingQueue_put_get(qbcli, app1, item1, item2):
    nt.assert_false(qbcli.exists(app1))
    # instantiating LockingQueue does not create any objects in backend
    queue = qbcli.LockingQueue(app1)
    nt.assert_equal(queue.size(), 0)

    # fail if consuming before you've gotten anything
    with nt.assert_raises(UserWarning):
        queue.consume()

    # get nothing from an empty queue (and don't fail!)
    nt.assert_is_none(queue.get())

    # put item in queue
    nt.assert_equal(queue.size(), 0)
    queue.put(item1)
    queue.put(item2)
    queue.put(item1)
    nt.assert_equal(queue.size(), 3)

    nt.assert_equal(queue.get(0), item1)
    nt.assert_equal(queue.get(), item1)

    # Multiple LockingQueue instances can address the same path
    queue2 = qbcli.LockingQueue(app1)
    nt.assert_equal(queue2.size(), 3)
    nt.assert_equal(queue2.get(), item2)
    nt.assert_equal(queue.get(), item1)  # ensure not somehow mutable or linked

    # cleanup
    queue.consume()
    queue2.consume()
开发者ID:kszucs,项目名称:stolos,代码行数:32,代码来源:test_return_values.py


示例9: test_reset_password

    def test_reset_password(self, PasswordResetTokenGeneratorMock):
        data = {
            'email': self.user.email,
        }

        PasswordResetTokenGeneratorMock.return_value = 'abc'

        response = self.client.post(
            path=self.reset_password_url,
            data=json.dumps(data),
            content_type='application/json',
        )

        assert_equals(response.status_code, status.HTTP_201_CREATED)
        assert_equals(len(mail.outbox), 1)
        assert_equals(mail.outbox[0].subject, 'Reset Your Password')

        data = {
            'reset_token': 'abc',
            'new_password': self.new_password,
            'password_confirmation': self.new_password,
        }

        response = self.client.post(
            path=self.reset_password_complete_url,
            data=json.dumps(data),
            content_type='application/json'
        )

        assert_equals(response.status_code, status.HTTP_200_OK)
        assert_true(User.objects.get(pk=self.user.id).check_password(self.new_password))
        assert_is_none(cache.get(self.user.email))
开发者ID:kofic,项目名称:sana.protocol_builder,代码行数:32,代码来源:test_users.py


示例10: test_footer

    def test_footer(self):
        toc = [
            navigation.NavItem(
                url='/preamble/2016_02749/cfr_changes/478',
                title=navigation.Title('Authority', '27 CFR 478', 'Authority'),
                markup_id='2016_02749-cfr-478',
                category='27 CFR 478'),
            navigation.NavItem(
                url='/preamble/2016_02749/cfr_changes/478-99',
                title=navigation.Title(
                    '§ 478.99 Certain', '§ 478.99', 'Certain'),
                markup_id='2016_02749-cfr-478-99',
                category='27 CFR 478'),
            navigation.NavItem(
                url='/preamble/2016_02749/cfr_changes/478-120',
                title=navigation.Title(
                    '§ 478.120 Firearms', '§ 478.120', 'Firearms'),
                markup_id='2016_02749-cfr-478-120',
                category='27 CFR 478')
        ]

        nav = navigation.footer([], toc, '2016_02749-cfr-478')
        assert_is_none(nav['previous'])
        assert_equal(nav['next'].section_id, '2016_02749-cfr-478-99')

        nav = navigation.footer([], toc, '2016_02749-cfr-478-99')
        assert_equal(nav['previous'].section_id, '2016_02749-cfr-478')
        assert_equal(nav['next'].section_id, '2016_02749-cfr-478-120')

        nav = navigation.footer([], toc, '2016_02749-cfr-478-120')
        assert_equal(nav['previous'].section_id, '2016_02749-cfr-478-99')
        assert_is_none(nav['next'])
开发者ID:donjo,项目名称:regulations-site,代码行数:32,代码来源:navigation_tests.py


示例11: test_init

    def test_init(self):
        #test default parameters
        exp = Experiment("test", {"x": MinMaxNumericParamDef(0, 1)})

        opt = BayesianOptimizer(exp)
        assert_equal(opt.initial_random_runs, 10)
        assert_is_none(opt.acquisition_hyperparams)
        assert_equal(opt.num_gp_restarts, 10)
        assert_true(isinstance(opt.acquisition_function, ExpectedImprovement))
        assert_dict_equal(opt.kernel_params, {})
        assert_equal(opt.kernel, "matern52")

        #test correct initialization
        opt_arguments = {
            "initial_random_runs": 5,
            "acquisition_hyperparams": {},
            "num_gp_restarts": 5,
            "acquisition": ProbabilityOfImprovement,
            "kernel_params": {},
            "kernel": "matern52",
            "mcmc": True,
        }
        opt = BayesianOptimizer(exp, opt_arguments)

        assert_equal(opt.initial_random_runs, 5)
        assert_dict_equal(opt.acquisition_hyperparams, {})
        assert_equal(opt.num_gp_restarts, 5)
        assert_true(isinstance(opt.acquisition_function, ProbabilityOfImprovement))
        assert_dict_equal(opt.kernel_params, {})
        assert_equal(opt.kernel, "matern52")
开发者ID:simudream,项目名称:apsis,代码行数:30,代码来源:test_bayesian_optimization.py


示例12: test_after_remove_authorized_user_not_self

 def test_after_remove_authorized_user_not_self(self):
     message = self.node_settings.after_remove_contributor(
         self.node, self.user_settings.owner)
     self.node_settings.save()
     assert_is_none(self.node_settings.user_settings)
     assert_true(message)
     assert_in('You can re-authenticate', message)
开发者ID:caseyrollins,项目名称:osf.io,代码行数:7,代码来源:models.py


示例13: test_get_credentials__provider_not_return_credentials

    def test_get_credentials__provider_not_return_credentials(self):
        self.cred_provider.get_synapse_credentials.return_value = None

        creds = self.credential_provider_chain.get_credentials(syn, self.user_login_args)

        assert_is_none(creds)
        self.cred_provider.get_synapse_credentials.assert_called_once_with(syn, self.user_login_args)
开发者ID:Sage-Bionetworks,项目名称:synapsePythonClient,代码行数:7,代码来源:unit_test_cred_provider.py


示例14: test_construct_factory_from_form

def test_construct_factory_from_form():
    form_factory = construct_factory_from_form(DjangoTestForm)
    assert_true(issubclass(form_factory, FormFactory))
    assert_equal(form_factory._meta.form, DjangoTestForm)
    assert_is_none(form_factory._meta.fields)
    assert_is_none(form_factory._meta.exclude)
    assert_equal(form_factory._meta.settings, {})
开发者ID:kyakovenko,项目名称:factory-boy-forms,代码行数:7,代码来源:test_utils.py


示例15: test_no_score

 def test_no_score(self):
     models.StateNameVoter.items.create(
         state_lname_fname="PA_APP_GERRY",
         persuasion_score='1.2',
     )
     bulk_impute([self.user], 'gotv_score')
     tools.assert_is_none(self.user.gotv_score)
开发者ID:edgeflip,项目名称:edgeflip,代码行数:7,代码来源:test_match.py


示例16: DoFlattenForm

def DoFlattenForm(pdf_path_in, pdf_path_out):
	fh = filehandler.FileHandler(pdf_path_in)
	#print fh.files
	#print fh.data # should be {}
	
	api_request = api_client.make_request('FlattenForm')
	api_response = api_request(fh.files, inputName='BadIntentions DoFlattenForm')
	
	print 'HTTP Response:', api_response.http_code
	if api_response.ok:
		assert_equal(api_response.http_code, requests.codes.ok)
		# api_response.output is the requested document or image.
		assert_is_none(api_response.error_code)
		assert_is_none(api_response.error_message)
		
		rh = responsehandler.ResponseHandler(api_response, pdf_path_out)
		rh.save_output()
		
		#print '---------- BadIntentions DoFlattenForm ----------'
		#print rh
		#print '-------------------------------------------------'
	else:
		print responsehandler.ResponseHandler(api_response, pdf_path_out)
		exit
	
	return pdf_path_out
开发者ID:datalogics-bhaugen,项目名称:pdf-web-api-clients,代码行数:26,代码来源:support.py


示例17: test_create_debug_session

def test_create_debug_session():
    gps = GPS(debug=1)
    assert_equal(gps.host, 'localhost')
    assert_equal(gps.port, '2947')
    assert_true(gps.debug)
    assert_false(gps.exit_flag)
    assert_is_none(gps.session)
开发者ID:BulletTime,项目名称:datalogger,代码行数:7,代码来源:test_GPS.py


示例18: DoExportFormData

def DoExportFormData(pdf_path_in, fdf_path_out):
	fh = filehandler.FileHandler(pdf_path_in)
	#print fh.files
	#print fh.data # should be {}
	
	options = {'exportXFDF': False}
	api_request = api_client.make_request('ExportFormData')
	api_response = api_request(fh.files, inputName='BadIntentions DoExportFormData', options=options)
	
	print 'HTTP Response:', api_response.http_code
	if api_response.ok:
		assert_equal(api_response.http_code, requests.codes.ok)
		# api_response.output is the requested document or image.
		assert_is_none(api_response.error_code)
		assert_is_none(api_response.error_message)
		
		rh = responsehandler.ResponseHandler(api_response, fdf_path_out)
		rh.save_output()
		
		#print '---------- BadIntentions DoExportFormData ----------'
		#print rh
		#print '----------------------------------------------------'
	else:
		print responsehandler.ResponseHandler(api_response, fdf_path_out)
		exit
	
	return fdf_path_out
开发者ID:datalogics-bhaugen,项目名称:pdf-web-api-clients,代码行数:27,代码来源:support.py


示例19: test_array_init

    def test_array_init(self):

        # normal initialization
        store = dict()
        init_array(store, shape=100, chunks=10)
        a = Array(store)
        assert_is_instance(a, Array)
        eq((100,), a.shape)
        eq((10,), a.chunks)
        eq('', a.path)
        assert_is_none(a.name)
        assert_is(store, a.store)

        # initialize at path
        store = dict()
        init_array(store, shape=100, chunks=10, path='foo/bar')
        a = Array(store, path='foo/bar')
        assert_is_instance(a, Array)
        eq((100,), a.shape)
        eq((10,), a.chunks)
        eq('foo/bar', a.path)
        eq('/foo/bar', a.name)
        assert_is(store, a.store)

        # store not initialized
        store = dict()
        with assert_raises(KeyError):
            Array(store)

        # group is in the way
        store = dict()
        init_group(store, path='baz')
        with assert_raises(KeyError):
            Array(store, path='baz')
开发者ID:alimanfoo,项目名称:zarr,代码行数:34,代码来源:test_core.py


示例20: DoRenderPages

def DoRenderPages(pdf_path_or_url_in, jpg_path_out):
	fh = filehandler.FileHandler(pdf_path_or_url_in)
	#print fh.files
	#print fh.data
	
	options = {'outputFormat': 'jpg', 'printPreview': True}
	api_request = api_client.make_request('RenderPages')
	
	if len(fh.data) > 0:
		api_response = api_request(fh.files, inputURL=fh.data['inputURL'], inputName='BadIntentions RenderPages', options=options)
	elif len(fh.files) > 0:
		api_response = api_request(fh.files, inputName='BadIntentions RenderPages', options=options)
	else:
		print 'data set not suitable for WebAPI'
		exit
	
	print 'HTTP Response:', api_response.http_code
	if api_response.ok:
		assert_equal(api_response.http_code, requests.codes.ok)
		# api_response.output is the requested document or image.
		assert_is_none(api_response.error_code)
		assert_is_none(api_response.error_message)
		
		rh = responsehandler.ResponseHandler(api_response, jpg_path_out)
		rh.save_output()
		
		#print '---------- BadIntentions RenderPages ----------'
		#print rh
		#print '----------------------------------------------'
	else:
		print responsehandler.ResponseHandler(api_response, jpg_path_out)
		exit
	
	return jpg_path_out
开发者ID:datalogics-bhaugen,项目名称:pdf-web-api-clients,代码行数:34,代码来源:support.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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