Esempio n. 1
0
def get_dir_with_most_merges(dataset_bpe_path, n_merges) -> Optional[str]:
    max_merges = get_max_merges(dataset_bpe_path, n_merges)
    if not max_merges:
        return None

    dir_with_most_merges = os.path.join(dataset_bpe_path, str(max_merges))
    return dir_with_most_merges
Esempio n. 2
0
def test_max_simple(mock):
    assert get_max_merges(PATH_TO_DATASET_BPE_DIR_STUB, 20) == 20
Esempio n. 3
0
def test_min_one_folder_available(mock):
    assert get_max_merges(PATH_TO_DATASET_BPE_DIR_STUB) == 10
Esempio n. 4
0
def test_max_all_folders_above_limit(mock):
    assert get_max_merges(PATH_TO_DATASET_BPE_DIR_STUB, 5) is None
Esempio n. 5
0
def test_max_with_non_number_folder(mock):
    assert get_max_merges(PATH_TO_DATASET_BPE_DIR_STUB) is None
Esempio n. 6
0
def test_max_no_folders(mock):
    assert get_max_merges(PATH_TO_DATASET_BPE_DIR_STUB) is None
Esempio n. 7
0
def test_none(mocked_walk):
    assert get_max_merges('.') is None