本文整理汇总了Python中source.shape_checker.get_triangle_type函数的典型用法代码示例。如果您正苦于以下问题:Python get_triangle_type函数的具体用法?Python get_triangle_type怎么用?Python get_triangle_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_triangle_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_get_triangle_equilateral_all_int
def test_get_triangle_equilateral_all_int(self):
result = get_triangle_type(1.003, 1.003, 1.003)
self.assertEqual(result, 'equilateral')
result = get_triangle_type(1, 2, 3)
self.assertEqual(result, 'scalene')
result = get_triangle_type(1, 1, 3)
self.assertEqual(result, 'isosceles')
开发者ID:AaronMWallace,项目名称:CST-236-2016,代码行数:9,代码来源:shape_checker_test.py
示例2: test_get_triangle
def test_get_triangle(self):
ret = get_triangle_type(-5, 5, 5)
self.assertEqual(ret, "invalid")
my_dict = {
1:1,
2:2,
3:3,
}
ret2 = get_triangle_type(my_dict)
self.assertEqual(ret2, "scalene")
my_list = [5,4,6]
ret = get_triangle_type(my_list)
self.assertEqual(ret, "scalene")
开发者ID:AaronMWallace,项目名称:CST-236-2016,代码行数:15,代码来源:shape_checker_test.py
示例3: test_get_triangle_type_not_list
def test_get_triangle_type_not_list(self):
"""
func that test for invalid condition
:rtype: object
"""
result = get_triangle_type((1, 2), 2, 5)
self.assertEqual(result, 'invalid')
开发者ID:OregonTech,项目名称:ZaidR,代码行数:7,代码来源:shape_checker_test.py
示例4: test_get_triangle_ltz_all_int
def test_get_triangle_ltz_all_int(self):
"""
Test that invalid thrown when side value less than zero entered
:return:
"""
result = get_triangle_type(-1, -1, -1)
self.assertEqual(result, 'invalid')
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:7,代码来源:shape_checker_test.py
示例5: test_get_triangle_input_all_int
def test_get_triangle_input_all_int(self):
"""
Test for invalid input
:return:
"""
result = get_triangle_type('a', "DEADBEEF", 'Z')
self.assertEqual(result, 'invalid')
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:7,代码来源:shape_checker_test.py
示例6: test_get_triangle_equilateral_all_int_performance
def test_get_triangle_equilateral_all_int_performance(self):
start_time = time.clock()
result = get_triangle_type(1, 1, 1)
end_time = time.clock()
delta_time = end_time - start_time
self.assertLessEqual(delta_time, 0.00002)
self.assertEqual(result, 'equilateral')
开发者ID:PaulIvanov,项目名称:CST236-Testing,代码行数:7,代码来源:shape_checker_test.py
示例7: test_tri_invalid_all_char
def test_tri_invalid_all_char(self):
"""
Test triangle invalid char input
:return: assertion: invalid
"""
result = get_triangle_type('a', 'b', 'c')
self.assertEqual(result, 'invalid')
开发者ID:Derek132435,项目名称:CST-236-Lab-7,代码行数:7,代码来源:shape_checker_test.py
示例8: test_tri_isosceles_neg
def test_tri_isosceles_neg(self):
"""
Test triangle isosceles negative input
:return: assertion: invalid
"""
result = get_triangle_type(-1, 1, 1)
self.assertEqual(result, 'invalid')
开发者ID:Derek132435,项目名称:CST-236-Lab-7,代码行数:7,代码来源:shape_checker_test.py
示例9: test_get_triangle_iso_all_int
def test_get_triangle_iso_all_int(self):
"""
test for isosceles triangle
:return:
"""
result = get_triangle_type(3, 3, 2)
self.assertEqual(result, 'isosceles')
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:7,代码来源:shape_checker_test.py
示例10: test_tri_scalene_all_int
def test_tri_scalene_all_int(self):
"""
Test triangle scalene all integer input
:return: assertion: scalene
"""
result = get_triangle_type(1, 2, 3)
self.assertEqual(result, 'scalene')
开发者ID:Derek132435,项目名称:CST-236-Lab-7,代码行数:7,代码来源:shape_checker_test.py
示例11: test_tri_isosceles_all_int
def test_tri_isosceles_all_int(self):
"""
Test triangle isosceles all integer input
:return: assertion: isosceles
"""
result = get_triangle_type(1, 1, 3)
self.assertEqual(result, 'isosceles')
开发者ID:Derek132435,项目名称:CST-236-Lab-7,代码行数:7,代码来源:shape_checker_test.py
示例12: test_get_triangle_equilateral_all_int
def test_get_triangle_equilateral_all_int(self):
"""
:return:
"""
result = get_triangle_type(1, 1, 1)
self.assertEqual(result, 'equilateral')
开发者ID:rmkennell,项目名称:CST236,代码行数:7,代码来源:shape_checker_test.py
示例13: test_tri_equilateral_all_int
def test_tri_equilateral_all_int(self):
"""
Test triangle equilateral all integer input
:return: assertion: equilateral
"""
result = get_triangle_type(1, 1, 1)
self.assertEqual(result, 'equilateral')
开发者ID:Derek132435,项目名称:CST-236-Lab-7,代码行数:7,代码来源:shape_checker_test.py
示例14: test_get_triangle_scal_all_int
def test_get_triangle_scal_all_int(self):
"""
Check that for triangle scalene
:return:
"""
result = get_triangle_type(1, 2, 3)
self.assertEqual(result, 'scalene')
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:7,代码来源:shape_checker_test.py
示例15: test_tri_scalene_all_float
def test_tri_scalene_all_float(self):
"""
Test triangle scalene all float input
:return: assertion: scalene
"""
result = get_triangle_type(1.2, 1.3, 1.1)
self.assertEqual(result, 'scalene')
开发者ID:Derek132435,项目名称:CST-236-Lab-7,代码行数:7,代码来源:shape_checker_test.py
示例16: test_get_triangle_equil_all_int
def test_get_triangle_equil_all_int(self):
"""
Check correct return for equilateral triangle
:return:
"""
result = get_triangle_type(1, 1, 1)
self.assertEqual(result, 'equilateral')
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:7,代码来源:shape_checker_test.py
示例17: test_get_triangle_type_not_char_third
def test_get_triangle_type_not_char_third(self):
"""
func that test for invalid condition
:rtype: object
"""
result = get_triangle_type(1, 1, 'a')
self.assertEqual(result, 'invalid')
开发者ID:OregonTech,项目名称:ZaidR,代码行数:8,代码来源:shape_checker_test.py
示例18: test_tri_equilateral_list
def test_tri_equilateral_list(self):
"""
Test triangle equilateral list input
:return: assertion: equilateral
"""
var_l = [1, 1, 1]
result = get_triangle_type(var_l)
self.assertEqual(result, 'equilateral')
开发者ID:Derek132435,项目名称:CST-236-Lab-7,代码行数:8,代码来源:shape_checker_test.py
示例19: test_get_triangle_dict_all_int
def test_get_triangle_dict_all_int(self):
"""
Tests retrieving triangle from dict.
:return:
"""
triangle = {'a': 1, 'b': 2, 'c': 3}
result = get_triangle_type(triangle)
self.assertEqual(result, 'scalene')
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:8,代码来源:shape_checker_test.py
示例20: test_get_triangle_tuple_all_int
def test_get_triangle_tuple_all_int(self):
"""
tests triangle type, assert scalene
:return:
"""
triangle = (3, 2, 1)
result = get_triangle_type(triangle)
self.assertEqual(result, 'scalene')
开发者ID:patrickcarlson,项目名称:CST-236,代码行数:8,代码来源:shape_checker_test.py
注:本文中的source.shape_checker.get_triangle_type函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论