示例#1
0
def test_find_version_none():
    gold = "1"
    items = []
    with patch('mead.utils._listdir') as list_patch:
        list_patch.return_value = items
        res = find_model_version(None)
    assert res == gold
示例#2
0
def test_find_version_non_int_only():
    gold = "1"
    items = [rand_str for _ in range(random.randint(1, 3))]
    with patch('mead.utils._listdir') as list_patch:
        list_patch = items
        res = find_model_version(None)
    assert res == gold
示例#3
0
def test_find_version():
    gold = random.randint(5, 15)
    items = list(map(str, range(gold)))
    gold = str(gold)
    with patch('mead.utils._listdir') as list_patch:
        list_patch.return_value = items
        res = find_model_version(None)
    assert res == gold
示例#4
0
def test_find_version_non_int():
    gold = random.randint(5, 15)
    items = list(map(str, random.sample(range(gold), gold // 2)))
    items.append(str(gold - 1))
    gold = str(gold)
    items.insert(random.randint(0, len(items)), rand_str())
    with patch('mead.utils._listdir') as list_patch:
        list_patch.return_value = items
        res = find_model_version(None)
    assert res == gold