本文整理汇总了Python中utilities.humanize_class函数的典型用法代码示例。如果您正苦于以下问题:Python humanize_class函数的具体用法?Python humanize_class怎么用?Python humanize_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了humanize_class函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_humanize_class4
def test_humanize_class4(self):
"""Test humanize class 4
First class interval > 1
Interval < 1
"""
my_array = [7.1, 7.5, 7.9]
my_result_class = humanize_class(my_array)
my_expected_class = [('0', '7.1'),
('7.1', '7.5'),
('7.5', '7.9')]
my_msg = 'got: ' + str(my_result_class)
my_msg += ' expect: ' + str(my_expected_class)
print_class(my_array, my_result_class, my_expected_class)
assert my_result_class == my_expected_class, my_msg
开发者ID:danylaksono,项目名称:inasafe,代码行数:14,代码来源:test_utilities.py
示例2: test_humanize_class2
def test_humanize_class2(self):
"""Test humanize class 2
First class interval > 1
Interval > 1
"""
my_array = [1.1, 5754.1, 11507.1]
my_result_class = humanize_class(my_array)
my_expected_class = [('0', '1'),
('1', '5,754'),
('5,754', '11,507')]
print_class(my_array, my_result_class, my_expected_class)
my_msg = 'got: ' + str(my_result_class)
my_msg += ' expect: ' + str(my_expected_class)
assert my_result_class == my_expected_class, my_msg
开发者ID:danylaksono,项目名称:inasafe,代码行数:14,代码来源:test_utilities.py
示例3: test_humanize_class
def test_humanize_class(self):
"""Test humanize class
First class interval < 1
Interval > 1
"""
my_array = [0.1, 1.2, 2.3, 3.4, 4.5]
my_result_class = humanize_class(my_array)
my_expected_class = [('0', '0.1'),
('0.1', '1.2'),
('1.2', '2.3'),
('2.3', '3.4'),
('3.4', '4.5')]
print_class(my_array, my_result_class, my_expected_class)
my_msg = 'got: ' + str(my_result_class)
my_msg += ' expect: ' + str(my_expected_class)
assert my_result_class == my_expected_class, my_msg
开发者ID:danylaksono,项目名称:inasafe,代码行数:16,代码来源:test_utilities.py
示例4: test_humanize_class6
def test_humanize_class6(self):
"""Test humanize class 5
First class interval < 1
Interval > 1
"""
my_array = [0, 6.1, 7.2, 8.3, 9.4, 10.5]
my_result_class = humanize_class(my_array)
my_expected_class = [('0', '6'),
('6', '7'),
('7', '8'),
('8', '9'),
('9', '11')]
print_class(my_array, my_result_class, my_expected_class)
my_msg = 'got: ' + str(my_result_class)
my_msg += ' expect: ' + str(my_expected_class)
assert my_result_class == my_expected_class, my_msg
开发者ID:danylaksono,项目名称:inasafe,代码行数:16,代码来源:test_utilities.py
注:本文中的utilities.humanize_class函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论