Exemple #1
0
 def test_tlgu_convert_fail(self):
     """Test the TLGU to fail when importing a corpus that doesn't exist."""
     tlgu = TLGU(testing=True)
     with self.assertRaises(AssertionError):
         tlgu.convert(
             "~/Downloads/corpora/TLG_E/bad_path.txt", "~/Documents/thucydides.txt"
         )
Exemple #2
0
    def test_tlgu_convert(self):
        """Test TLGU convert. This reads the file
        ``tlgu_test_text_beta_code.txt``, which mimics a TLG file, and
        converts it.
        Note: assertEquals fails on some accented characters ('ή', 'ί').
        """
        in_test = os.path.abspath('cltk/tests/tlgu_test_text_beta_code.txt')
        out_test = os.path.expanduser('~/cltk_data/tlgu_test_text_unicode.txt')
        tlgu = TLGU(testing=True)
        tlgu.convert(in_test, out_test)
        with open(out_test) as out_file:
            new_text = out_file.read()
        os.remove(out_test)
        target = """
βλλον δ' ἀλλλους χαλκρεσιν ἐγχεῃσιν.
"""
        self.assertEqual(new_text, target)
Exemple #3
0
    def test_tlgu_convert(self):
        """Test TLGU convert. This reads the file
        ``tlgu_test_text_beta_code.txt``, which mimics a TLG file, and
        converts it.
        Note: assertEquals fails on some accented characters ('ή', 'ί').
        """
        in_test = os.path.abspath('cltk/tests/tlgu_test_text_beta_code.txt')
        out_test = os.path.expanduser('~/cltk_data/tlgu_test_text_unicode.txt')
        tlgu = TLGU(testing=True)
        tlgu.convert(in_test, out_test)
        with open(out_test) as out_file:
            new_text = out_file.read()
        os.remove(out_test)
        target = """
βλλον δ' ἀλλλους χαλκρεσιν ἐγχεῃσιν.
"""
        self.assertEqual(new_text, target)
Exemple #4
0
 def test_tlgu_init(self):
     """Test constructors of TLGU module for check, import, and install."""
     tlgu = TLGU(testing=True)
     self.assertTrue(tlgu)
Exemple #5
0
 def test_tlgu_convert_corpus_fail(self):
     """Test the TLGU to fail when trying to convert an unsupported corpus."""
     tlgu = TLGU(testing=True)
     with self.assertRaises(AssertionError):
         tlgu.convert_corpus(corpus='bad_corpus')
Exemple #6
0
 def test_tlgu_convert_corpus_fail(self):
     """Test the TLGU to fail when trying to convert an unsupported corpus."""
     tlgu = TLGU(testing=True)
     with self.assertRaises(AssertionError):
         tlgu.convert_corpus(corpus='bad_corpus')
Exemple #7
0
 def test_tlgu_convert_fail(self):
     """Test the TLGU to fail when importing a corpus that doesn't exist."""
     tlgu = TLGU(testing=True)
     with self.assertRaises(AssertionError):
         tlgu.convert('~/Downloads/corpora/TLG_E/bad_path.txt',
                      '~/Documents/thucydides.txt')