Skip to content

Commit

Permalink
Add more file tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Jun 30, 2017
1 parent 2064a2b commit 8cbfc88
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ def test_load_corpus(self):

self.assertTrue(len(corpus))


class CorpusFilePathTestCase(TestCase):

def setUp(self):
self.corpus = Corpus()

def test_load_corpus_file(self):
"""
Test that a file path can be specified for a corpus.
Expand Down Expand Up @@ -158,3 +164,24 @@ def test_load_corpus_file_non_existent(self):
self.assertFalse(os.path.exists(file_path))
with self.assertRaises(IOError):
corpus = self.corpus.load_corpus(file_path)

def test_load_corpus_english_greetings(self):
file_path = os.path.join(self.corpus.data_directory, 'english', 'greetings.yml')

corpus = self.corpus.load_corpus(file_path)

self.assertEqual(len(corpus), 1)

def test_load_corpus_english(self):
file_path = os.path.join(self.corpus.data_directory, 'english')

corpus = self.corpus.load_corpus(file_path)

self.assertGreater(len(corpus), 1)

def test_load_corpus_english_trailing_slash(self):
file_path = os.path.join(self.corpus.data_directory, 'english') + '/'

corpus = self.corpus.load_corpus(file_path)

self.assertGreater(len(corpus), 1)

0 comments on commit 8cbfc88

Please sign in to comment.