def test_concordance_from_file_ioerror(self): """Test ``write_concordance_from_file()`` for file writing completion of concordance builder, with IOError. Doesn't test quality of output.""" philology = Philology() bad_path = '/cltk_data/user_data/concordance_test_file.txt' with self.assertRaises(IOError): philology.write_concordance_from_file(bad_path, 'test_file')
def test_concordance_from_file(self): """Test ``write_concordance_from_file()`` for file writing completion of concordance builder. Doesn't test quality of output.""" philology = Philology() file = 'cltk/tests/bad_pickle.pickle' philology.write_concordance_from_file(file, 'test_file') file = os.path.expanduser('~/cltk_data/user_data/concordance_test_file.txt') is_file = os.path.isfile(file) self.assertTrue(is_file)
def test_concordance_from_string(self): """Test ``write_concordance_from_string()`` for file writing completion of concordance builder. Doesn't test quality of output.""" philology = Philology() text = 'felices cantus ore sonante dedit' philology.write_concordance_from_string(text, 'test_string') file = os.path.expanduser('~/cltk_data/user_data/concordance_test_string.txt') is_file = os.path.isfile(file) self.assertTrue(is_file)