예제 #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)