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

Python service.details函数代码示例

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

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



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


示例16: test_count_of_high_volume_services

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

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

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


示例17: test_has_detailed_page_when_in_csv

    def test_has_detailed_page_when_in_csv(self):
        service_with_details = Service(details({
            "Detailed view?": "yes"
        }))
        service_without_details = Service(details({
             "Detailed view?": ""
        }))
        service_explicitly_without_details = Service(details({
             "Detailed view?": "no"
        }))

        assert_that(service_with_details.has_details_page, is_(True))
        assert_that(service_without_details.has_details_page, is_(False))
        assert_that(service_explicitly_without_details.has_details_page, is_(False))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:14,代码来源:test_service.py


示例18: test_takeup_is_none_if_volume_is_none

    def test_takeup_is_none_if_volume_is_none(self):
        services = [
            Service(details({
                '2012-Q4 Digital vol.': '5',
                u'High-volume?': 'yes'
            })),
            Service(details({
                '2012-Q4 Digital vol.': '10',
                u'High-volume?': 'yes'
            })),
        ]

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

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


示例19: test_cost_is_none_when_no_high_volume_services

    def test_cost_is_none_when_no_high_volume_services(self):
        services = [
            Service(details({
                "2012-Q4 Vol.": "2,000",
                u'2012-Q4 CPT (\xa3)': "2.00",
            })),
            Service(details({
                "2013-Q1 Vol.": "1,000",
                u'2013-Q1 CPT (\xa3)': "3.00",
            })),
        ]

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

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


示例20: test_agency_abbr_is_full_name_if_not_supplied

    def test_agency_abbr_is_full_name_if_not_supplied(self):
        service = Service(details({
            "Agency/body": "A and B and C",
            "Agency abbr": "",
        }))

        assert_that(service.agency_abbreviation, is_("A and B and C"))
开发者ID:cliffshepp,项目名称:transactions-explorer,代码行数:7,代码来源:test_service.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python service.SpawnedService类代码示例发布时间:2022-05-27
下一篇:
Python server.SERVER类代码示例发布时间: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