📌  相关文章
📜  第 27 天:测试hackerrank 解决方案 python 代码示例

📅  最后修改于: 2022-03-11 14:45:10.607000             🧑  作者: Mango

代码示例1
# Day 27: Testing hackerrank solution python
def minimum_index(seq):
    if len(seq) == 0:
        raise ValueError("Cannot get the minimum value index from an empty sequence")
    min_idx = 0
    for i in range(1, len(seq)):
        if seq[i] < seq[min_idx]:
            min_idx = i
    return min_idx
class TestDataEmptyArray(object):
    
    @staticmethod
    def get_array():
        return list()

class TestDataUniqueValues(object):

    @staticmethod
    def get_array():
        return [7,9,1,2,-7,10,22]

    @staticmethod
    def get_expected_result():
        return 4

class TestDataExactlyTwoDifferentMinimums(object):

    @staticmethod
    def get_array():
        return [7,9,1,2,-7,10,22,-7]

    @staticmethod
    def get_expected_result():
        return 4