示例#1
0
 def test_that_min_frags_larger_than_max_frags_raises_an_error(self, min_frags, max_frags, test_corpus_path):
     with pytest.raises(WoodblockError):
         intertwine_randomly(test_corpus_path, 2, min_fragments=min_frags, max_fragments=max_frags)
示例#2
0
 def test_that_consecutive_fragments_are_from_different_files(self, num_files, min_frags, max_frags,
                                                              test_corpus_path):
     frags = intertwine_randomly(test_corpus_path, num_files, min_fragments=min_frags, max_fragments=max_frags)
     for i in range(1, len(frags)):
         assert frags[i - 1].metadata['file']['id'] != frags[i].metadata['file']['id']
示例#3
0
 def test_that_the_correct_number_of_files_gets_drawn(self, num_files, test_corpus_path):
     frags = intertwine_randomly(test_corpus_path, num_files)
     assert _get_number_of_files_from_fragment_list(frags) == num_files
示例#4
0
 def test_that_invalid_number_of_files_raises_an_error(self, num_files, test_corpus_path):
     with pytest.raises(WoodblockError):
         intertwine_randomly(test_corpus_path, num_files)
示例#5
0
 def test_that_invalid_paths_raise_an_error(self, path):
     with pytest.raises(WoodblockError):
         intertwine_randomly(pathlib.Path(path), number_of_files=2)
示例#6
0
 def test_that_an_error_is_raised_when_the_path_is_empty(self):
     with TemporaryDirectory() as tmpdir:
         with pytest.raises(WoodblockError):
             intertwine_randomly(tmpdir)