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


Python six.assertRegex函数代码示例

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


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

示例1: test_source_methods_with_full_model

    def test_source_methods_with_full_model(self):
        from sherpa.utils.err import IdentifierErr

        ui.load_data('full', self.ascii)
        ui.set_full_model('full', 'powlaw1d.p1')

        # Test Case 1
        try:
            ui.get_source('full')
        except IdentifierErr as e:
            six.assertRegex(self, str(e),
                                     "Convolved model\n.*\n is set for dataset full. You should use get_model instead.",
                                     str(e))
        try:
            ui.plot_source('full')
        except IdentifierErr as e:
            six.assertRegex(self, str(e),
                                     "Convolved model\n.*\n is set for dataset full. You should use plot_model instead.",
                                     str(e))

        # Test Case 2
        ui.set_source('full', 'powlaw1d.p2')
        ui.get_source('full')

        # Test Case 3
        ui.load_data('not_full', self.ascii)
        try:
            ui.get_source('not_full')
        except IdentifierErr as e:
            self.assertEqual('source not_full has not been set, consider using set_source() or set_model()', str(e))
开发者ID:DougBurke,项目名称:sherpa,代码行数:30,代码来源:test_ui.py

示例2: test_list_ipblocks

    def test_list_ipblocks(self):
        ipblocks = self.client.list_ipblocks()

        self.assertGreater(len(ipblocks), 0)
        self.assertGreater(ipblocks['items'][0]['properties']['size'], 0)
        assertRegex(self, ipblocks['items'][0]['id'], self.resource['uuid_match'])
        self.assertIn(ipblocks['items'][0]['properties']['location'], self.resource['locations'])
开发者ID:jbuchhammer,项目名称:profitbricks-sdk-python,代码行数:7,代码来源:test_ipblock_live.py

示例3: test_list

    def test_list(self):
        servers = self.client.list_servers(datacenter_id=self.datacenter['id'])

        self.assertGreater(len(servers), 0)
        self.assertEqual(servers['items'][0]['type'], 'server')
        self.assertTrue(self, len(servers['items'])>0)
        assertRegex(self, servers['items'][0]['id'], self.resource['uuid_match'])
开发者ID:fbrehm,项目名称:profitbricks-sdk-python,代码行数:7,代码来源:test_server_live.py

示例4: test_panEncryptionAlgo0

 def test_panEncryptionAlgo0(self):
     pan_in = '4876010123456789012'
     panEnc, pan = pci.encrypt(pan_in, None, '00', self.depco)
     # self.assertEqual(pan, pan_in.encode('hex'))
     six.assertRegex(self, panEnc, r'00\d+')
     panClr, data = pci.decrypt(panEnc, self.depco)
     self.assertEqual(pan_in, panClr)
开发者ID:NormanDenayer,项目名称:dep,代码行数:7,代码来源:test_dep.py

示例5: assert_status_of_phase

    def assert_status_of_phase(self, output, status, phase, test_name, xfail=None):
        """Asserts that 'output' contains a line showing the given
        status for the given phase for the given test_name.

        'xfail' should have one of the following values:
        - None (the default): assertion passes regardless of whether there is an
          EXPECTED/UNEXPECTED string
        - 'no': The line should end with the phase, with no additional text after that
        - 'expected': After the phase, the line should contain '(EXPECTED FAILURE)'
        - 'unexpected': After the phase, the line should contain '(UNEXPECTED'
        """
        expected = (r'^ *{} +'.format(re.escape(status)) +
                    self._test_name_and_phase_regex(test_name, phase))

        if xfail == 'no':
            # There should be no other text after the testname and phase regex
            expected += r' *$'
        elif xfail == 'expected':
            expected += r' *{}'.format(re.escape(test_status.TEST_EXPECTED_FAILURE_COMMENT))
        elif xfail == 'unexpected':
            expected += r' *{}'.format(re.escape(test_status.TEST_UNEXPECTED_FAILURE_COMMENT_START))
        else:
            expect(xfail is None, "Unhandled value of xfail argument")

        expected_re = re.compile(expected, flags=re.MULTILINE)
        six.assertRegex(self, output, expected_re)
开发者ID:fischer-ncar,项目名称:cime,代码行数:26,代码来源:custom_assertions_test_status.py

示例6: test_node_default_attrs

 def test_node_default_attrs(self):
     tasks = [
         {'id': 'task-A'},
     ]
     dotgraph = self.get_dotgraph_with_tasks(tasks)
     six.assertRegex(self, dotgraph, '"task-A" .*color=yellowgreen.*;')
     six.assertRegex(self, dotgraph, '"task-A" .*style=filled.*;')
开发者ID:ekorekin,项目名称:fuel-web,代码行数:7,代码来源:test_graph.py

示例7: testKeyFile

    def testKeyFile(self):
        # Make sure sha512 appears in returned file documents
        resp = self.request('/file/%s' % self.publicFile['_id'])
        self.assertStatusOk(resp)
        self.assertEqual(resp.json['sha512'], self.publicFile['sha512'])

        template = '/file/%s/hashsum_file/%s'

        # Test with bad algo
        resp = self.request(template % (self.publicFile['_id'], 'foo'))
        self.assertStatus(resp, 400)
        six.assertRegex(self, resp.json['message'], '^Invalid value for algo: "foo"')

        # Should work with public file
        resp = self.request(template % (self.publicFile['_id'], 'sha512'),
                            isJson=False)
        self.assertStatusOk(resp)
        respBody = self.getBody(resp)
        self.assertEqual(respBody, '%s\n' % self.publicFile['sha512'])
        self.assertEqual(len(respBody), 129)

        # Should not work with private file
        resp = self.request(template % (self.privateFile['_id'], 'sha512'))
        self.assertStatus(resp, 401)
        six.assertRegex(self, resp.json['message'], '^Read access denied')
开发者ID:data-exp-lab,项目名称:girder,代码行数:25,代码来源:hashsum_download_test.py

示例8: test_list_images

    def test_list_images(self):
        images = self.client.list_images()

        assertRegex(self, images['items'][0]['id'], self.resource['uuid_match'])
        self.assertGreater(len(images), 0)
        self.assertEqual(images['items'][0]['type'], 'image')
        self.assertTrue(self, len(images['items']) > 0)
开发者ID:fbrehm,项目名称:profitbricks-sdk-python,代码行数:7,代码来源:test_image_live.py

示例9: test_create_complex

    def test_create_complex(self):
        fwrule = FirewallRule(**self.resource['fwrule'])
        nic = NIC(firewall_rules=[fwrule], **self.resource['nic'])
        volume = Volume(image=self.image['id'],
                        image_password='secretpassword123',
                        ssh_keys=['ssh-rsa AAAAB3NzaC1'],
                        **self.resource['volume'])

        server = Server(
            nics=[nic],
            create_volumes=[volume],
            **self.resource['server'])

        composite_server = self.client.create_server(
            datacenter_id=self.datacenter['id'],
            server=server)
        wait_for_completion(self.client, composite_server, 'create_server', wait_timeout=600)

        composite_server = self.client.get_server(
            datacenter_id=self.datacenter['id'],
            server_id=composite_server['id'])

        assertRegex(self, composite_server['id'], self.resource['uuid_match'])
        self.assertEqual(composite_server['properties']['name'], self.resource['server']['name'])
        self.assertEqual(composite_server['properties']['cores'], self.resource['server']['cores'])
        self.assertEqual(composite_server['properties']['ram'], self.resource['server']['ram'])
        self.assertEqual(composite_server['properties']['availabilityZone'], 'AUTO')
        self.assertIn(composite_server['properties']['vmState'], self.resource['vm_states'])
开发者ID:jbuchhammer,项目名称:profitbricks-sdk-python,代码行数:28,代码来源:test_server_live.py

示例10: test_unset_http_equiv_2

 def test_unset_http_equiv_2(self):
     htmlmeta_hub.pyramid_helpers.htmlmeta_set('refresh', '15', request=self.request)
     b = htmlmeta_hub.pyramid_helpers.htmlmeta_as_html(request=self.request)
     six.assertRegex(self, b, re_refresh_15)
     htmlmeta_hub.pyramid_helpers.htmlmeta_unset('refresh', request=self.request)
     b = htmlmeta_hub.pyramid_helpers.htmlmeta_as_html(request=self.request)
     self.assertNotRegexpMatches(b, re_refresh_15)
开发者ID:jvanasco,项目名称:htmlmeta_hub,代码行数:7,代码来源:tests.py

示例11: test_encryptlist

 def test_encryptlist(self):
     enc_data = best.encryptlist(self.depco,
                             ['67033111201401507', '67033111201401556'],
                             '20AEC80DEC6474265EA3657B8D8BAA0DEE5058',
                             key_variant='01', ksk='01',
                             enc2key='00000000000000201508281410376874')
     for elt in enc_data:
         six.assertRegex(self, elt, r'^[A-F0-9]{32}$')
开发者ID:NormanDenayer,项目名称:dep,代码行数:8,代码来源:test_dep.py

示例12: test_encrypt_ecb

 def test_encrypt_ecb(self):
     e2k, enc_data = best.encrypt(self.depco,
                                  '0102030401020304',
                                  'B426EE161E95AAE7EBE131D4BF63C71F15F2D8',
                                   ksk='01',
                                   enc2key='00000000000000201508281410361909')
     six.assertRegex(self, enc_data, r'^[A-F0-9]{16}')
     six.assertRegex(self, e2k, r'^[A-F0-9]{32}$')
开发者ID:NormanDenayer,项目名称:dep,代码行数:8,代码来源:test_dep.py

示例13: assert_status_of_phase

    def assert_status_of_phase(self, output, status, phase, test_name):
        """Asserts that 'output' contains a line showing the given
        status for the given phase for the given test_name"""
        expected = re.compile(r'^ *{} +'.format(re.escape(status)) +
                              self._test_name_and_phase_regex(test_name, phase),
                              flags=re.MULTILINE)

        six.assertRegex(self, output, expected)
开发者ID:bertinia,项目名称:cime,代码行数:8,代码来源:test_cs_status.py

示例14: test_get_ipblock

    def test_get_ipblock(self):
        ipblock = self.client.get_ipblock(self.ipblock1['id'])

        assertRegex(self, ipblock['id'], self.resource['uuid_match'])
        self.assertEqual(ipblock['id'], self.ipblock1['id'])
        self.assertEqual(ipblock['properties']['name'], (self.resource['ipblock']['name']))
        self.assertEqual(ipblock['properties']['size'], self.resource['ipblock']['size'])
        self.assertEqual(ipblock['properties']['location'], self.resource['ipblock']['location'])
开发者ID:fbrehm,项目名称:profitbricks-sdk-python,代码行数:8,代码来源:test_ipblock_live.py

示例15: test_print_report

    def test_print_report(self):
        io = six.StringIO()
        self.h.print_report(unit=self.unit, file=io)
        expect = r'''\AFunctionName  UsedBytes  AcquiredBytes  Occurrence
 +Exp +[0-9.\-e]+.?B +[0-9.\-e]+.?B +[0-9]+
 +ReLU +[0-9.\-e]+.?B +[0-9.\-e]+.?B +[0-9]+$
'''
        actual = io.getvalue()
        six.assertRegex(self, actual, expect)
开发者ID:asi1024,项目名称:chainer,代码行数:9,代码来源:test_cupy_memory_profile.py


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