def test_get_filenames_match_regex(self): filenames = list( data_processing.get_filenames(self.data_dir, match_regex='f1')) self.assertEqual(filenames, ['f1.html.corrected.txt']) filenames = list( data_processing.get_filenames(self.data_dir, match_regex='foo')) self.assertEqual(filenames, [])
def test_get_filenames_match_regex(self, datadir): filenames = list( data_processing.get_filenames(datadir, match_regex='f1')) assert filenames == ['f1.html.corrected.txt'] filenames = list( data_processing.get_filenames(datadir, match_regex='foo')) assert filenames == []
def test_get_filenames_extension(self): filenames = list( data_processing.get_filenames(self.data_dir, extension='.txt')) self.assertEqual(filenames, [ '{}.html.corrected.txt'.format(froot) for froot in self.fileroots ]) filenames = list( data_processing.get_filenames(self.data_dir, extension='.foo')) self.assertEqual(filenames, [])
def test_get_filenames_extension(self, fileroots, datadir): filenames = list( data_processing.get_filenames(datadir, extension='.txt')) assert (filenames == [ '{}.html.corrected.txt'.format(froot) for froot in fileroots ]) filenames = list( data_processing.get_filenames(datadir, extension='.foo')) assert filenames == []
def test_get_filenames_full_path(self): filenames = list( data_processing.get_filenames(self.data_dir, full_path=True)) self.assertEqual(filenames, [ os.path.join(self.data_dir, '{}.html.corrected.txt'.format(froot)) for froot in self.fileroots ])
def test_get_filenames_full_path(self, fileroots, datadir): filenames = list(data_processing.get_filenames(datadir, full_path=True)) assert (filenames == [ os.path.join(datadir, "{}.html.corrected.txt".format(froot)) for froot in fileroots ])
def test_get_filenames(self, fileroots, datadir): filenames = list(data_processing.get_filenames(datadir)) assert (filenames == [ "{}.html.corrected.txt".format(froot) for froot in fileroots ])