本文整理汇总了Python中tests.test_logger.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_hamming_distance_multiple
def test_hamming_distance_multiple(self):
test_logger.debug("FindNearestTest - test_hamming_distance_multiple Starts")
points = ["abcdef", "abcefg", "abcdeg"]
point = "abcdef"
find_nearest = FindNearest(points, point, HammingDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals(['abcdef', 'abcdeg'], nearest)
points = ["abcXdef", "abcXefg", "abcXdeg"]
point = "abcdefg"
find_nearest = FindNearest(points, point, HammingDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals(['abcXefg', 'abcXdeg'], nearest)
points = ["abcXdef", "abcXefg", "abcXdeg"]
point = "1234567"
find_nearest = FindNearest(points, point, HammingDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals(['abcXdef', 'abcXdef'], nearest)
points = ["abcXdef", "abcXefg", "abcXdeg"]
point = "123456 "
find_nearest = FindNearest(points, point, HammingDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals(['abcXdef', 'abcXdef'], nearest)
test_logger.debug("FindNearestTest - test_hamming_distance_multiple Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:32,代码来源:hamming_distance_test.py
示例2: test_damerau_levenshtein_distance_multiple
def test_damerau_levenshtein_distance_multiple(self):
test_logger.debug("FindNearestTest - test_damerau_levenshtein_distance_multiple Starts")
points = ["abcdef", "abcef", "abcde"]
point = "abcdefg"
find_nearest = FindNearest(points, point, DamerauLevenshteinDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals(['abcdef', 'abcef'], nearest)
points = ["abcXdef", "abcXef", "abcXde"]
point = "abcdefg"
find_nearest = FindNearest(points, point, DamerauLevenshteinDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals(['abcXdef', 'abcXdef'], nearest)
points = ["abcXdef", "abcXef", "abcXde"]
point = "123456"
find_nearest = FindNearest(points, point, DamerauLevenshteinDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals(['abcXef', 'abcXef'], nearest)
points = ["abcXdef", "abcXef", "abcXde"]
point = "123456 "
find_nearest = FindNearest(points, point, DamerauLevenshteinDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals(['abcXdef', 'abcXdef'], nearest)
test_logger.debug("FindNearestTest - test_damerau_levenshtein_distance_multiple Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:32,代码来源:damerau_levenshtein_distance_test.py
示例3: test_correlation_distance
def test_correlation_distance(self):
test_logger.debug("FindNearestTest - test_correlation_distance Starts")
points = [(2, 3), (3, 4), (4, 5)]
point = (2, 1)
find_nearest = FindNearest(points, point, CorrelationDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals((2, 3), nearest)
points = [(2, 3), (3, 4), (4, 5)]
point = (3, 2)
find_nearest = FindNearest(points, point, CorrelationDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals((2, 3), nearest)
points = [(2, 3), (3, 4), (4, 5)]
point = (3, 4)
find_nearest = FindNearest(points, point, CorrelationDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals((2, 3), nearest)
test_logger.debug("FindNearestTest - test_correlation_distance Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:25,代码来源:correlation_distance_test.py
示例4: test_correlation_distance_multiple
def test_correlation_distance_multiple(self):
test_logger.debug("FindNearestTest - test_correlation_distance_multiple Starts")
points = [(2, 3), (4, 6), (6, 5)]
point = (2, 1)
find_nearest = FindNearest(points, point, CorrelationDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([(6, 5), (2, 3)], nearest)
points = [(2, 3), (4, 6), (6, 5)]
point = (3, 2)
find_nearest = FindNearest(points, point, CorrelationDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([(6, 5), (2, 3)], nearest)
points = [(2, 3), (4, 6), (6, 5)]
point = (3, 1)
find_nearest = FindNearest(points, point, CorrelationDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([(6, 5), (2, 3)], nearest)
test_logger.debug("FindNearestTest - test_correlation_distance_multiple Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:25,代码来源:correlation_distance_test.py
示例5: test_edit_distance
def test_edit_distance(self):
test_logger.debug("FindNearestTest - test_edit_distance Starts")
points = ["abcdef", "abcef", "abcde"]
point = "abcdefg"
find_nearest = FindNearest(points, point, EditDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals("abcdef", nearest)
points = ["abcXdef", "abcXef", "abcXde"]
point = "abcdefg"
find_nearest = FindNearest(points, point, EditDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals("abcXdef", nearest)
points = ["abcXdef", "abcXef", "abcXde"]
point = "123456"
find_nearest = FindNearest(points, point, EditDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals("abcXef", nearest)
points = ["abcXdef", "abcXef", "abcXde"]
point = "123456 "
find_nearest = FindNearest(points, point, EditDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals("abcXdef", nearest)
test_logger.debug("FindNearestTest - test_edit_distance Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:32,代码来源:edit_distance_test.py
示例6: test_algorithm_with_list
def test_algorithm_with_list(self):
test_logger.debug("StandartDeviationTest - test_algorithm_with_list Starts")
standart_deviation = StandartDeviation()
data_list = [1, 2, 3, 4, 5]
self.assertEquals(1.5811, standart_deviation.calculate(data_list))
data_list = [1, 2, 3, 4]
self.assertEquals(1.291, standart_deviation.calculate(data_list))
test_logger.debug("StandartDeviationTest - test_algorithm_with_list Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:8,代码来源:standart_deviation_test.py
示例7: test_algorithm_with_tuple
def test_algorithm_with_tuple(self):
test_logger.debug("MeanTest - test_algorithm_with_tuple Starts")
mean = Mean()
data_list = [("a", 1), ("b", 2), ("c", 3), ( "d", 4), ("e", 5)]
self.assertEquals(3, mean.calculate(data_list, is_tuple=True, index=1))
data_list = [("a", "a", 1), ("b", "b", 2), ("c", "c", 3), ("d", "d", 4), ("e", "e", 5)]
self.assertEquals(3.0, mean.calculate(data_list, is_tuple=True, index=2))
test_logger.debug("MeanTest - test_algorithm_with_tuple Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:9,代码来源:mean_test.py
示例8: test_manhattan_distance_multiple
def test_manhattan_distance_multiple(self):
test_logger.debug("FindNearestTest - test_manhattan_distance_multiple Starts")
points = [(1, 0, 1, 0, 1, 0), (1, 0, 1, 0, 1, 1), (1, 0, 1, 1, 1, 0)]
point = (1, 0, 0, 0, 0, 0)
find_nearest = FindNearest(points, point, ManhattanDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([(1, 0, 1, 0, 1, 0), (1, 0, 1, 0, 1, 1)], nearest)
points = [(1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1), (1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1),
(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1)]
point = (0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1)
find_nearest = FindNearest(points, point, ManhattanDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1), (1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1)]
, nearest)
points = [(2, 3), (3, 4), (4, 5)]
point = (0, 1)
find_nearest = FindNearest(points, point, ManhattanDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([(2, 3), (3, 4)], nearest)
points = [(2, 3), (3, 4), (4, 5)]
point = (3, 3)
find_nearest = FindNearest(points, point, ManhattanDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([(2, 3), (2, 3)], nearest)
points = [(2, 3), (3, 4), (4, 5)]
point = (3, 4)
find_nearest = FindNearest(points, point, ManhattanDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([(3, 4), (2, 3)], nearest)
points = [[1], [5], [10]]
point = [8]
find_nearest = FindNearest(points, point, ManhattanDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([[10], [5]], nearest)
points = [[1], [5], [10]]
point = [17]
find_nearest = FindNearest(points, point, ManhattanDistance, k=2)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([[10], [5]], nearest)
test_logger.debug("FindNearestTest - test_manhattan_distance_multiple Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:55,代码来源:manhattan_distance_test.py
示例9: test_euclidean_distance
def test_euclidean_distance(self):
test_logger.debug("FindNearestTest - test_euclidean_distance Starts")
points = [(1, 0, 1, 0, 1, 0), (1, 0, 1, 0, 1, 1), (1, 0, 1, 1, 1, 0)]
point = (1, 0, 0, 0, 0, 0)
find_nearest = FindNearest(points, point, EuclideanDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals((1, 0, 1, 0, 1, 0), nearest)
points = [(1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1), (1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1),
(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1)]
point = (0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1)
find_nearest = FindNearest(points, point, EuclideanDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals((0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1), nearest)
points = [(2, 3), (3, 4), (4, 5)]
point = (0, 1)
find_nearest = FindNearest(points, point, EuclideanDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals((2, 3), nearest)
points = [(2, 3), (3, 4), (4, 5)]
point = (3, 3)
find_nearest = FindNearest(points, point, EuclideanDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals((2, 3), nearest)
points = [(2, 3), (3, 4), (4, 5)]
point = (3, 4)
find_nearest = FindNearest(points, point, EuclideanDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals((3, 4), nearest)
points = [[1], [5], [10]]
point = [8]
find_nearest = FindNearest(points, point, EuclideanDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([10], nearest)
points = [[1], [5], [10]]
point = [17]
find_nearest = FindNearest(points, point, EuclideanDistance)
find_nearest.process()
nearest = find_nearest.get_result()
self.assertEquals([10], nearest)
test_logger.debug("FindNearestTest - test_euclidean_distance Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:54,代码来源:euclidean_distance_test.py
示例10: test_algorithm
def test_algorithm(self):
test_logger.debug("FindNearestTest - test_algorithm Starts")
points = "abcdef"
point = "abcdefg"
with self.assertRaises(TypeError) as context:
FindNearest(points, point, "")
self.assertEqual("You must initialize array and a point",
context.exception.message)
test_logger.debug("FindNearestTest - test_algorithm Starts")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:11,代码来源:find_nearest_test.py
示例11: test_algorithm
def test_algorithm(self):
test_logger.debug("CosineDistanceTest - test_algorithm Starts")
data = [(1, 2, 3), (3, 5, 7)]
cosine_distance = CosineDistance(data)
cosine_distance.process()
result = cosine_distance.get_result()
self.assertEquals(0.002585096956942312, result)
data = [(1, 2, 3, 4), (1, 2, 3, 6)]
cosine_distance = CosineDistance(data)
cosine_distance.process()
result = cosine_distance.get_result()
self.assertEquals(0.018844218960787695, result)
data = [(3, 1), (4, 1)]
cosine_distance = CosineDistance(data)
cosine_distance.process()
result = cosine_distance.get_result()
self.assertEquals(0.002945514498418511, result)
data = [[3], [4]]
cosine_distance = CosineDistance(data)
cosine_distance.process()
result = cosine_distance.get_result()
self.assertEquals(0.0, result)
data = [[3, 4], [6, 8]]
cosine_distance = CosineDistance(data)
cosine_distance.process()
result = cosine_distance.get_result()
self.assertEquals(0.0, result)
data = [[3], [4, 5, 6]]
cosine_distance = CosineDistance(data)
with self.assertRaises(ArithmeticError) as context:
cosine_distance.process()
self.assertEqual('You cant calculate Cosine distance of array has different sizes.',
context.exception.message)
data = [["a"], [4]]
cosine_distance = CosineDistance(data)
with self.assertRaises(TypeError) as context:
cosine_distance.process()
self.assertEqual("unsupported operand type(s) for +: 'int' and 'str'",
context.exception.message)
data = []
cosine_distance = CosineDistance(data)
with self.assertRaises(ArithmeticError) as context:
cosine_distance.process()
self.assertEqual('You must enter two array to find Cosine distance.',
context.exception.message)
test_logger.debug("CosineDistanceTest - test_algorithm Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:54,代码来源:cosine_distance_test.py
示例12: test_algorithm
def test_algorithm(self):
test_logger.debug("ManhattanDistanceTest - test_algorithm Starts")
data = [(1, 2, 3, 4), (1, 2, 3, 6)]
manhattan_distance = ManhattanDistance(data)
manhattan_distance.process()
result = manhattan_distance.get_result()
self.assertEquals(2.0, result)
data = [(1, 2, 3, 4), (5, 6, 7, 8)]
manhattan_distance = ManhattanDistance(data)
manhattan_distance.process()
result = manhattan_distance.get_result()
self.assertEquals(16.0, result)
data = [(3, 1), (4, 1)]
manhattan_distance = ManhattanDistance(data)
manhattan_distance.process()
result = manhattan_distance.get_result()
self.assertEquals(1.0, result)
data = [(3, 1, 5), (5, 5, 3)]
manhattan_distance = ManhattanDistance(data)
manhattan_distance.process()
result = manhattan_distance.get_result()
self.assertEquals(8.0, result)
data = [[3], [4]]
manhattan_distance = ManhattanDistance(data)
manhattan_distance.process()
result = manhattan_distance.get_result()
self.assertEquals(1.0, result)
data = [[3], [4, 5, 6]]
manhattan_distance = ManhattanDistance(data)
with self.assertRaises(ArithmeticError) as context:
manhattan_distance.process()
self.assertEqual('You cant calculate Manhattan distance of array has different sizes.',
context.exception.message)
data = [["a"], [4]]
manhattan_distance = ManhattanDistance(data)
with self.assertRaises(TypeError) as context:
manhattan_distance.process()
self.assertEqual("unsupported operand type(s) for -: 'int' and 'str'",
context.exception.message)
data = []
manhattan_distance = ManhattanDistance(data)
with self.assertRaises(ArithmeticError) as context:
manhattan_distance.process()
self.assertEqual('You must enter two array to find Manhattan distance.',
context.exception.message)
test_logger.debug("ManhattanDistanceTest - test_algorithm Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:54,代码来源:manhattan_distance_test.py
示例13: test_algorithm_with_tuple
def test_algorithm_with_tuple(self):
test_logger.debug("VarianceTest - test_algorithm_with_tuple Starts")
variance = Variance()
data_list = [("a", 1), ("b", 2), ("c", 3), ( "d", 4), ("e", 5)]
self.assertEquals(2.5, variance.calculate(data_list, is_tuple=True, index=1))
data_list = [("a", "a", 1), ("b", "b", 2), ("c", "c", 3), ("d", "d", 4), ("e", "e", 5)]
self.assertEquals(2.5, variance.calculate(data_list, is_tuple=True, index=2))
data_list = [("a", "a", 1), ("b", "b", 2), ("c", "c", 3), ("d", "d", 4)]
self.assertEquals(1.6667, variance.calculate(data_list, is_tuple=True, index=2))
test_logger.debug("VarianceTest - test_algorithm_with_tuple Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:12,代码来源:variance_test.py
示例14: test_algorithm_with_tuple
def test_algorithm_with_tuple(self):
test_logger.debug("StandartDeviationTest - test_algorithm_with_tuple Starts")
standart_deviation = StandartDeviation()
data_list = [("a", 1), ("b", 2), ("c", 3), ( "d", 4), ("e", 5)]
self.assertEquals(1.5811, standart_deviation.calculate(data_list, is_tuple=True, index=1))
data_list = [("a", "a", 1), ("b", "b", 2), ("c", "c", 3), ("d", "d", 4), ("e", "e", 5)]
self.assertEquals(1.5811, standart_deviation.calculate(data_list, is_tuple=True, index=2))
data_list = [("a", "a", 1), ("b", "b", 2), ("c", "c", 3), ("d", "d", 4)]
self.assertEquals(1.291, standart_deviation.calculate(data_list, is_tuple=True, index=2))
test_logger.debug("StandartDeviationTest - test_algorithm_with_tuple Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:12,代码来源:standart_deviation_test.py
示例15: test_formula
def test_formula(self):
test_logger.debug("SumFormulaTest - test_formula Starts")
sum_formula = SumFormula()
data_list = [1, 2, 3, 4, 5]
self.assertEquals(15, sum_formula.calculate(data_list))
data_list = [1, 2, 3, 4]
self.assertEquals(10, sum_formula.calculate(data_list))
data_list = [2]
self.assertEquals(4, sum_formula.calculate(data_list, power=2))
data_list = [1, 2, 3, 4]
self.assertEquals(30, sum_formula.calculate(data_list, power=2))
test_logger.debug("SumFormulaTest - test_formula Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:12,代码来源:sum_formula_test.py
示例16: test_algorithm_with_tuple
def test_algorithm_with_tuple(self):
test_logger.debug("SumFormulaTest - test_algorithm_with_tuple Starts")
sum_formula = SumFormula()
data_list = [("a", 1), ("b", 2), ("c", 3), ( "d", 4), ("e", 5)]
self.assertEquals(15, sum_formula.calculate(data_list, is_tuple=True, index=1))
data_list = [("a", "a", 1), ("b", "b", 2), ("c", "c", 3), ("d", "d", 4), ("e", "e", 5)]
self.assertEquals(15, sum_formula.calculate(data_list, is_tuple=True, index=2))
data_list = [("a", "a", 1), ("e", "e", 5)]
self.assertEquals(26, sum_formula.calculate(data_list, is_tuple=True, index=2, power=2))
test_logger.debug("SumFormulaTest - test_algorithm_with_tuple Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:12,代码来源:sum_formula_test.py
示例17: test_algorithm_with_list
def test_algorithm_with_list(self):
test_logger.debug("MeanTest - test_algorithm_with_list Starts")
mean = Mean()
data_list = [1, 2, 3, 4, 5]
self.assertEquals(3, mean.calculate(data_list))
data_list = [1, 2, 3, 4]
self.assertEquals(2.5, mean.calculate(data_list))
data_list = []
with self.assertRaises(ZeroDivisionError) as context:
mean.calculate(data_list)
self.assertEqual("integer division or modulo by zero",
context.exception.message)
test_logger.debug("MeanTest - test_algorithm_with_list Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:13,代码来源:mean_test.py
示例18: test_algorithm_with_list
def test_algorithm_with_list(self):
test_logger.debug("VarianceTest - test_algorithm_with_list Starts")
variance = Variance()
data_list = [1, 2, 3, 4, 5]
self.assertEquals(2.5, variance.calculate(data_list))
data_list = [1, 2, 3, 4]
self.assertEquals(1.6667, variance.calculate(data_list))
data_list = []
with self.assertRaises(ZeroDivisionError) as context:
variance.calculate(data_list)
self.assertEqual("integer division or modulo by zero",
context.exception.message)
test_logger.debug("VarianceTest - test_algorithm_with_list Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:13,代码来源:variance_test.py
示例19: test_algorithm_with_list
def test_algorithm_with_list(self):
test_logger.debug("MedianTest - test_algorithm_with_list Starts")
median = Median()
data_list = [1, 2, 3, 4, 5]
self.assertEquals(3, median.calculate(data_list))
data_list = [1, 2, 3, 4]
self.assertEquals(2, median.calculate(data_list))
data_list = []
with self.assertRaises(IndexError) as context:
median.calculate(data_list)
self.assertEqual("list index out of range",
context.exception.message)
test_logger.debug("MedianTest - test_algorithm_with_list Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:15,代码来源:median_test.py
示例20: test_algorithm
def test_algorithm(self):
test_logger.debug("ChessBoardDistanceTest - test_algorithm Starts")
data = [(1, 2, 3, 4), (1, 2, 3, 8)]
chessboard_distance = ChessBoardDistance(data)
chessboard_distance.process()
result = chessboard_distance.get_result()
self.assertEquals(4.0, result)
data = [(3, 1), (4, 1)]
chessboard_distance = ChessBoardDistance(data)
chessboard_distance.process()
result = chessboard_distance.get_result()
self.assertEquals(1.0, result)
data = [(-3, 1), (4, 1)]
chessboard_distance = ChessBoardDistance(data)
chessboard_distance.process()
result = chessboard_distance.get_result()
self.assertEquals(7.0, result)
data = [[3], [4]]
chessboard_distance = ChessBoardDistance(data)
chessboard_distance.process()
result = chessboard_distance.get_result()
self.assertEquals(1.0, result)
data = [[3], [4, 5, 6]]
chessboard_distance = ChessBoardDistance(data)
with self.assertRaises(ArithmeticError) as context:
chessboard_distance.process()
self.assertEqual('You cant calculate Chess Board distance of array has different sizes.',
context.exception.message)
data = [["a"], [4]]
chessboard_distance = ChessBoardDistance(data)
with self.assertRaises(TypeError) as context:
chessboard_distance.process()
self.assertEqual("unsupported operand type(s) for -: 'int' and 'str'",
context.exception.message)
data = []
chessboard_distance = ChessBoardDistance(data)
with self.assertRaises(ArithmeticError) as context:
chessboard_distance.process()
self.assertEqual('You must enter two array to find Chess Board distance.',
context.exception.message)
test_logger.debug("ChessBoardDistanceTest - test_algorithm Ends")
开发者ID:RayleighChen,项目名称:similarityPy,代码行数:48,代码来源:chessboard_distance_test.py
注:本文中的tests.test_logger.debug函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论