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


Python matchers.GreaterThan方法代码示例

本文整理汇总了Python中testtools.matchers.GreaterThan方法的典型用法代码示例。如果您正苦于以下问题:Python matchers.GreaterThan方法的具体用法?Python matchers.GreaterThan怎么用?Python matchers.GreaterThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testtools.matchers的用法示例。


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

示例1: test_delete_recordset

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_delete_recordset(self):
        zone = self.create_zone()
        original_serial = zone.serial

        # Create a recordset
        recordset = self.create_recordset(zone)

        # Delete the recordset
        self.central_service.delete_recordset(
            self.admin_context, zone['id'], recordset['id'])

        # Fetch the recordset again, ensuring an exception is raised
        exc = self.assertRaises(rpc_dispatcher.ExpectedException,
                                self.central_service.get_recordset,
                                self.admin_context, zone['id'],
                                recordset['id'])

        self.assertEqual(exceptions.RecordSetNotFound, exc.exc_info[0])

        # Fetch the zone again to verify serial number increased
        updated_zone = self.central_service.get_zone(self.admin_context,
                                                     zone.id)
        new_serial = updated_zone.serial
        self.assertThat(new_serial, GreaterThan(original_serial)) 
开发者ID:openstack,项目名称:designate,代码行数:26,代码来源:test_service.py

示例2: test_extension_failure_custom_callback

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_extension_failure_custom_callback(self):
        errors = []

        def failure_callback(manager, entrypoint, error):
            errors.append((manager, entrypoint, error))

        em = extension.ExtensionManager('stevedore.test.extension',
                                        invoke_on_load=True,
                                        on_load_failure_callback=
                                        failure_callback)
        extensions = list(em.extensions)
        self.assertTrue(len(extensions), GreaterThan(0))
        self.assertEqual(len(errors), 2)
        for manager, entrypoint, error in errors:
            self.assertIs(manager, em)
            self.assertIsInstance(error, (IOError, ImportError)) 
开发者ID:openstack,项目名称:stevedore,代码行数:18,代码来源:test_callback.py

示例3: test_extension_failure_custom_callback

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_extension_failure_custom_callback(self):
        errors = []

        def failure_callback(manager, entrypoint, error):
            errors.append((manager, entrypoint, error))

        em = extension.ExtensionManager('stevedore.test.extension',
                                        invoke_on_load=True,
                                        on_load_failure_callback=
                                        failure_callback)
        extensions = list(em.extensions)
        self.assertThat(len(extensions), GreaterThan(0))
        self.assertEqual(len(errors), 2)
        for manager, entrypoint, error in errors:
            self.assertIs(manager, em)
            self.assertIsInstance(error, (IOError, ImportError)) 
开发者ID:morpheus65535,项目名称:bazarr,代码行数:18,代码来源:test_callback.py

示例4: test_ordering

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_ordering(self):
        ordered_versions = [
            "1.2.3.dev6",
            "1.2.3.dev7",
            "1.2.3.a4.dev12",
            "1.2.3.a4.dev13",
            "1.2.3.a4",
            "1.2.3.a5.dev1",
            "1.2.3.a5",
            "1.2.3.b3.dev1",
            "1.2.3.b3",
            "1.2.3.rc2.dev1",
            "1.2.3.rc2",
            "1.2.3.rc3.dev1",
            "1.2.3",
            "1.2.4",
            "1.3.3",
            "2.2.3",
        ]
        for v in ordered_versions:
            sv = version.SemanticVersion.from_pip_string(v)
            self.expectThat(sv, matchers.Equals(sv))
        for left, right in itertools.combinations(ordered_versions, 2):
            l_pos = ordered_versions.index(left)
            r_pos = ordered_versions.index(right)
            if l_pos < r_pos:
                m1 = matchers.LessThan
                m2 = matchers.GreaterThan
            else:
                m1 = matchers.GreaterThan
                m2 = matchers.LessThan
            left_sv = version.SemanticVersion.from_pip_string(left)
            right_sv = version.SemanticVersion.from_pip_string(right)
            self.expectThat(left_sv, m1(right_sv))
            self.expectThat(right_sv, m2(left_sv)) 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:37,代码来源:test_version.py

示例5: test_create_recordset_with_records

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_create_recordset_with_records(self):
        zone = self.create_zone()
        original_serial = zone.serial

        # Create the Object
        recordset = objects.RecordSet(
            name='www.%s' % zone.name,
            type='A',
            records=objects.RecordList(objects=[
                objects.Record(data='192.3.3.15'),
                objects.Record(data='192.3.3.16'),
            ])
        )

        # Persist the Object
        recordset = self.central_service.create_recordset(
            self.admin_context, zone.id, recordset=recordset)

        # Get updated serial number
        updated_zone = self.central_service.get_zone(self.admin_context,
                                                     zone.id)
        new_serial = updated_zone.serial

        # Ensure all values have been set correctly
        self.assertIsNotNone(recordset.records)
        self.assertEqual(2, len(recordset.records))
        self.assertIsNotNone(recordset.records[0].id)
        self.assertIsNotNone(recordset.records[1].id)
        self.assertThat(new_serial, GreaterThan(original_serial)) 
开发者ID:openstack,项目名称:designate,代码行数:31,代码来源:test_service.py

示例6: test_update_recordset

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_update_recordset(self):
        # Create a zone
        zone = self.create_zone()
        original_serial = zone.serial

        # Create a recordset
        recordset = self.create_recordset(zone)

        # Update the recordset
        recordset.ttl = 1800

        # Perform the update
        self.central_service.update_recordset(self.admin_context, recordset)

        # Get zone again to verify that serial number was updated
        updated_zone = self.central_service.get_zone(self.admin_context,
                                                     zone.id)
        new_serial = updated_zone.serial

        # Fetch the resource again
        recordset = self.central_service.get_recordset(
            self.admin_context, recordset.zone_id, recordset.id)

        # Ensure the new value took
        self.assertEqual(1800, recordset.ttl)
        self.assertThat(new_serial, GreaterThan(original_serial)) 
开发者ID:openstack,项目名称:designate,代码行数:28,代码来源:test_service.py

示例7: test_update_recordset_with_record_delete

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_update_recordset_with_record_delete(self):
        # Create a zone
        zone = self.create_zone()
        original_serial = zone.serial

        # Create a recordset and two records
        recordset = self.create_recordset(zone)
        self.create_record(zone, recordset)
        self.create_record(zone, recordset, fixture=1)

        # Append two new Records
        recordset.records.append(objects.Record(data='192.0.2.1'))
        recordset.records.append(objects.Record(data='192.0.2.2'))

        # Remove one of the Records
        recordset.records.pop(0)

        # Perform the update
        self.central_service.update_recordset(self.admin_context, recordset)

        # Fetch the RecordSet again
        recordset = self.central_service.get_recordset(
            self.admin_context, zone.id, recordset.id)

        # Fetch the Zone again
        updated_zone = self.central_service.get_zone(self.admin_context,
                                                     zone.id)
        new_serial = updated_zone.serial

        # Ensure two Records are attached to the RecordSet correctly
        self.assertEqual(1, len(recordset.records))
        self.assertIsNotNone(recordset.records[0].id)
        self.assertThat(new_serial, GreaterThan(original_serial)) 
开发者ID:openstack,项目名称:designate,代码行数:35,代码来源:test_service.py

示例8: _dep_order_tests_helper

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def _dep_order_tests_helper(self, cfy_local, node_ids_param,
                                ordered_node_ids_of_instances,
                                indices_pairs_for_time_diff_assertions):
        params = self._get_params(
            op='cloudify.interfaces.lifecycle.start',
            node_ids=node_ids_param,
            run_by_dep=True)
        cfy_local.execute('execute_operation', params, task_thread_pool_size=4)

        instances_and_visit_times = sorted(
            ((inst, inst.runtime_properties['visit_time']) for inst in
             cfy_local.storage.get_node_instances() if 'visit_time' in
             inst.runtime_properties),
            key=lambda inst_and_time: inst_and_time[1])

        self.assertEqual(ordered_node_ids_of_instances,
                         [inst_and_time[0].node_id for inst_and_time in
                          instances_and_visit_times])

        # asserting time difference between the operation execution for the
        # different nodes. this way if something breaks and the tasks aren't
        # dependent on one another, there's a better chance we'll catch
        # it, since even if the order of the visits happens to be correct,
        # it's less likely there'll be a significant time difference between
        # the visits
        def assert_time_difference(earlier_inst_index, later_inst_index):
            td = instances_and_visit_times[later_inst_index][1] - \
                instances_and_visit_times[earlier_inst_index][1]
            self.assertThat(td, MatchesAny(Equals(1), GreaterThan(1)))

        for index1, index2 in indices_pairs_for_time_diff_assertions:
            assert_time_difference(index1, index2) 
开发者ID:cloudify-cosmo,项目名称:cloudify-plugins-common,代码行数:34,代码来源:test_builtin_workflows.py

示例9: assertGreater

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def assertGreater(self, first, second):
        matcher = matchers.GreaterThan(first)
        self.assertThat(second, matcher) 
开发者ID:openstack,项目名称:taskflow,代码行数:5,代码来源:test.py

示例10: test_set_current_entry_updates_updated_time

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_set_current_entry_updates_updated_time(self):
        region = factory.make_RegionController()
        hostname = factory.make_hostname()
        ip = factory.make_ip_address()
        yesterday = datetime.now() - timedelta(days=1)
        factory.make_RDNS(ip, hostname, region, updated=yesterday)
        # Nothing changed, so expect that only the last updated time changed.
        RDNS.objects.set_current_entry(ip, [hostname], region)
        result = RDNS.objects.first()
        self.assertThat(result.updated, GreaterThan(yesterday)) 
开发者ID:maas,项目名称:maas,代码行数:12,代码来源:test_rdns.py

示例11: test_elapsed

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_elapsed(self, mock_now):
        mock_now.side_effect = monotonic_iter(incr=0.2)
        watch = timeutils.StopWatch()
        watch.start()
        matcher = matchers.GreaterThan(0.19)
        self.assertThat(watch.elapsed(), matcher) 
开发者ID:openstack,项目名称:oslo.utils,代码行数:8,代码来源:test_timeutils.py

示例12: test_context_manager

# 需要导入模块: from testtools import matchers [as 别名]
# 或者: from testtools.matchers import GreaterThan [as 别名]
def test_context_manager(self, mock_now):
        mock_now.side_effect = monotonic_iter()
        with timeutils.StopWatch() as watch:
            pass
        matcher = matchers.GreaterThan(0.04)
        self.assertThat(watch.elapsed(), matcher) 
开发者ID:openstack,项目名称:oslo.utils,代码行数:8,代码来源:test_timeutils.py


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