def test_enum_dataset_recursive2(self): """ enum_dataset_recursive case2: search recursively """ dirpath = 'resources/test_train/dataset2/in' files = dataset.enum_dataset_recursive([], dirpath) dir0 = os.path.join(dirpath, '0') dir1 = os.path.join(dirpath, '1') res = [(os.path.join(dir0, 'test1.png'), '0'), (os.path.join(dir1, 'test2.png'), '1')] assert sorted(files) == sorted(res)
def test_enum_dataset_recursive4(self): """ enum_dataset_recursive case4: not exists train data """ dirpath = 'resources/test_train/dataset4/in' files = dataset.enum_dataset_recursive([], dirpath) assert files == []
def test_enum_dataset_recursive3(self): """ enum_dataset_recursive case3: search not recursively (has no label)""" dirpath = 'resources/test_train/dataset3/in' files = dataset.enum_dataset_recursive([], dirpath) res = [(os.path.join(dirpath, 'test1.png'), '-1'), (os.path.join(dirpath, 'test2.png'), '-1')] assert sorted(files) == sorted(res)
def test_enum_dataset_recursive1(self): """ enum_dataset_recursive case1: dataset not exists """ dirpath = 'resources/test_train/dataset1/in' files = dataset.enum_dataset_recursive([], dirpath) assert files == []