本文整理汇总了Python中source.shape_checker.get_triangle_type函数的典型用法代码示例。如果您正苦于以下问题:Python get_triangle_type函数的具体用法?Python get_triangle_type怎么用?Python get_triangle_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_triangle_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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')
示例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")
示例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')
示例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')
示例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')
示例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')
示例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')
示例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')
示例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')
示例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')
示例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')
示例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')
示例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')
示例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')
示例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')