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


Python service.details函数代码示例

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


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

示例1: test_calculate_cost_change_from_previous_value

    def test_calculate_cost_change_from_previous_value(self):
        increase_service = Service(details({
            '2013-Q1 Vol.': '200',
            u'2013-Q1 CPT (\xa3)': '2',
            '2012-Q4 Vol.': '100',
            u'2012-Q4 CPT (\xa3)': '1',
        }))
        decrease_service = Service(details({
            '2013-Q1 Vol.': '100',
            u'2013-Q1 CPT (\xa3)': '1',
            '2012-Q4 Vol.': '100',
            u'2012-Q4 CPT (\xa3)': '2',
        }))
        no_previous_vol_service = Service(details({
            '2013-Q1 Vol.': '100',
            u'2013-Q1 CPT (\xa3)': '1',
            '2012-Q4 Vol.': '',
            u'2012-Q4 CPT (\xa3)': '',
        }))
        zero_previous_vol_service = Service(details({
            '2013-Q1 Vol.': '100',
            u'2013-Q1 CPT (\xa3)': '1',
            '2012-Q4 Vol.': '0',
            u'2012-Q4 CPT (\xa3)': '0',
        }))

        assert_that(increase_service.latest_kpi_for('cost_change'), is_(4))
        assert_that(decrease_service.latest_kpi_for('cost_change'), is_(0.5))
        assert_that(no_previous_vol_service.latest_kpi_for('cost_change'), is_(None))
        assert_that(zero_previous_vol_service.latest_kpi_for('cost_change'), is_(None))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:30,代码来源:test_service.py

示例2: test_data_coverage_excludes_non_high_volume_services

    def test_data_coverage_excludes_non_high_volume_services(self):
        services = [
            Service(details({
                "2012-Q4 Vol.": "2,000",
                '2012-Q4 Digital vol.': '10',
                u'2012-Q4 CPT (\xa3)': "2.00",
                "2013-Q1 Vol.": "2,000",
                u'2013-Q1 CPT (\xa3)': "2.00",
                '2013-Q1 Digital vol.': '10',
            })),
            Service(details({
                "2012-Q4 Vol.": "1,000",
                u'2012-Q4 CPT (\xa3)': "3.00",
                '2012-Q4 Digital vol.': '10',
                u'High-volume?': 'yes'
            })),
        ]

        dept = Department("Agency for Beautiful Code", services)

        coverage = dept.data_coverage

        assert_that(float(coverage.percentage), is_(0.125))
        assert_that(coverage.requested, is_(24))
        assert_that(coverage.provided, is_(3))
开发者ID:gds-attic,项目名称:transactions-explorer,代码行数:25,代码来源:test_department.py

示例3: test_data_coverage_when_quarter_not_requested

    def test_data_coverage_when_quarter_not_requested(self):
        services = [
            Service(details({
                "2012-Q4 Vol.": "2,000",
                '2012-Q4 Digital vol.': '10',
                u'2012-Q4 CPT (\xa3)': "2.00",
                "2013-Q1 Vol.": "***",
                u'2013-Q1 CPT (\xa3)': "***",
                '2013-Q1 Digital vol.': '***',
                u'High-volume?': 'yes'
            })),
            Service(details({
                "2012-Q4 Vol.": "1,000",
                u'2012-Q4 CPT (\xa3)': "3.00",
                '2012-Q4 Digital vol.': '10',
                u'High-volume?': 'yes'
            })),
        ]

        dept = Department("Agency for Beautiful Code", services)

        coverage = dept.data_coverage

        assert_that(float(coverage.percentage), close_to(0.1333333, 0.001))
        assert_that(coverage.requested, is_(45))
        assert_that(coverage.provided, is_(6))
开发者ID:gds-attic,项目名称:transactions-explorer,代码行数:26,代码来源:test_department.py

示例4: test_sum_of_total_transactions_when_kpis_are_missing

    def test_sum_of_total_transactions_when_kpis_are_missing(self):
        services = [Service(details({})),
                    Service(details({'2013-Q2 Vol.': '100'})),
                    Service(details({'2013-Q2 Vol.': '***'}))]

        assert_that(services[0].has_kpis, is_(False))
        assert_that(total_transaction_volume(services), is_(100))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:7,代码来源:test_service.py

示例5: test_calculate_takeup_change_from_previous_value

    def test_calculate_takeup_change_from_previous_value(self):
        increase_service = Service(details({
            '2013-Q1 Vol.': '200',
            '2013-Q1 Digital vol.': '200',
            '2012-Q4 Vol.': '100',
            '2012-Q4 Digital vol.': '50',
        }))
        decrease_service = Service(details({
            '2013-Q1 Vol.': '100',
            '2013-Q1 Digital vol.': '50',
            '2012-Q4 Vol.': '100',
            '2012-Q4 Digital vol.': '100',
        }))
        no_previous_vol_service = Service(details({
            '2013-Q1 Vol.': '100',
            '2013-Q1 Digital vol.': '100',
            '2012-Q4 Vol.': '',
            '2012-Q4 Digital vol.': '',
        }))
        zero_previous_vol_service = Service(details({
            '2013-Q1 Vol.': '100',
            '2013-Q1 Digital vol.': '100',
            '2012-Q4 Vol.': '0',
            '2012-Q4 Digital vol.': '0',
        }))

        assert_that(increase_service.latest_kpi_for('takeup_change'), is_(2))
        assert_that(decrease_service.latest_kpi_for('takeup_change'), is_(0.5))
        assert_that(no_previous_vol_service.latest_kpi_for('takeup_change'), is_(None))
        assert_that(zero_previous_vol_service.latest_kpi_for('takeup_change'), is_(None))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:30,代码来源:test_service.py

示例6: test_keywords

    def test_keywords(self):
        service_with_no_keywords = Service(details({'Keywords': None}))
        service_with_one_keywords = Service(details({'Keywords': 'keyword'}))
        service_with_two_keywords = Service(details({'Keywords': 'keyword1, keyword2'}))

        assert_that(service_with_no_keywords.keywords, is_([]))
        assert_that(service_with_one_keywords.keywords, is_(['keyword']))
        assert_that(service_with_two_keywords.keywords, is_(['keyword1', 'keyword2']))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:8,代码来源:test_service.py

示例7: test_volume_ignores_services_with_no_kpis

    def test_volume_ignores_services_with_no_kpis(self):
        services = [
            Service(details({"2012-Q4 Vol.": "2,000"})),
            Service(details({})),
        ]

        dept = Department("Agency for Beautiful Code", services)

        assert_that(dept.volume, is_(2000))
开发者ID:gds-attic,项目名称:transactions-explorer,代码行数:9,代码来源:test_department.py

示例8: test_link_is_first_services_slugified_abbreviation

    def test_link_is_first_services_slugified_abbreviation(self):
        services = [
            Service(details({u'Abbr': "ABC"})),
            Service(details({u'Abbr': "ABC"})),
        ]

        dept = Department("Agency for Beautiful Code", services)

        assert_that(dept.link, is_("department/abc/by-transactions-per-year/descending"))
开发者ID:gds-attic,项目名称:transactions-explorer,代码行数:9,代码来源:test_department.py

示例9: test_abbreviation_is_first_services_abbreviation

    def test_abbreviation_is_first_services_abbreviation(self):
        services = [
            Service(details({u'Abbr': "ABC"})),
            Service(details({u'Abbr': "ABC"})),
        ]

        dept = Department("Agency for Beautiful Code", services)

        assert_that(dept.abbr, is_("ABC"))
开发者ID:gds-attic,项目名称:transactions-explorer,代码行数:9,代码来源:test_department.py

示例10: test_volume_is_total_of_last_available_quarter_for_each_service

    def test_volume_is_total_of_last_available_quarter_for_each_service(self):
        services = [
            Service(details({"2012-Q4 Vol.": "1,000", "2013-Q1 Vol.": "1,500"})),
            Service(details({"2012-Q4 Vol.": "2,000"})),
        ]

        dept = Department("Agency for Beautiful Code", services)

        assert_that(dept.volume, is_(3500))
开发者ID:gds-attic,项目名称:transactions-explorer,代码行数:9,代码来源:test_department.py

示例11: test_most_up_to_date_volume

    def test_most_up_to_date_volume(self):
        service_with_one_vol = Service(details({'2013-Q1 Vol.': '200'}))
        service_with_two_vols = Service(details({'2013-Q1 Vol.': '200',
                                                 '2013-Q2 Vol.': '250'}))
        service_with_no_vols = Service(details({}))

        assert_that(service_with_one_vol.most_up_to_date_volume, is_(200))
        assert_that(service_with_two_vols.most_up_to_date_volume, is_(250))
        assert_that(service_with_no_vols.most_up_to_date_volume, is_(None))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:9,代码来源:test_service.py

示例12: test_dict_generation

    def test_dict_generation(self):
        services = [
            Service(details({"Name of service": "test_name_2", "Abbr": "tn2", "2013-Q3 Vol.": "6,400,000"})),
            Service(details({"Name of service": "test_name_3", "Abbr": "tn3", "2012-Q4 Vol.": "6,400,000"}))
        ]

        dicts = dict_map([("name", lambda s: s.name),
                          ("abbr", lambda s: s.abbr)],
                         services)

        assert_that(dicts[0], has_entries({'name': 'test_name_2', 'abbr': 'tn2'}))
        assert_that(dicts[1], has_entries({'name': 'test_name_3', 'abbr': 'tn3', 'historic': 'Apr 2011 to Mar 2012'}))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:12,代码来源:test_csv.py

示例13: test_building_a_list_of_departments_from_services

    def test_building_a_list_of_departments_from_services(self):
        services = [
            Service(details({u'Abbr': 'ABC', u'Department': "Agency for Beautiful Code"})),
            Service(details({u'Abbr': 'MSW', u'Department': "Ministry of Silly Walks"})),
            Service(details({u'Abbr': 'ABC', u'Department': "Agency for Beautiful Code"})),
        ]

        departments = Department.from_services(services)

        assert_that(len(departments), is_(2))
        assert_that(departments[0].name, is_("Agency for Beautiful Code"))
        assert_that(departments[0].services,
                    contains(services[0], services[2]))
开发者ID:gds-attic,项目名称:transactions-explorer,代码行数:13,代码来源:test_department.py

示例14: test_csv_generation

    def test_csv_generation(self):
        services = [
            Service(details({"Name of service": "test_name", "Abbr": "tn"})),
            Service(details({"Name of service": "test_name_2", "Abbr": "tn2"}))
        ]

        table = tabular_map([("name_column", lambda s: s.name),
                             ("abbr", lambda s: s.abbr)],
                            services)

        assert_that(table, is_([["name_column", "abbr"],
                                ["test_name", "tn"],
                                ["test_name_2", "tn2"]]))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:13,代码来源:test_csv.py

示例15: test_cost_is_none_when_no_kpi_is_available

    def test_cost_is_none_when_no_kpi_is_available(self):
        services = [
            Service(details({
                u'High-volume?': 'yes'
            })),
            Service(details({
                u'High-volume?': 'yes'
            })),
        ]

        dept = Department("Agency for Beautiful Code", services)

        assert_that(dept.cost, is_(None))
开发者ID:gds-attic,项目名称:transactions-explorer,代码行数:13,代码来源:test_department.py


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