Skip to content

Commit 8cbfc88

Browse files
committed
Add more file tests
1 parent 2064a2b commit 8cbfc88

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/test_corpus.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ def test_load_corpus(self):
126126

127127
self.assertTrue(len(corpus))
128128

129+
130+
class CorpusFilePathTestCase(TestCase):
131+
132+
def setUp(self):
133+
self.corpus = Corpus()
134+
129135
def test_load_corpus_file(self):
130136
"""
131137
Test that a file path can be specified for a corpus.
@@ -158,3 +164,24 @@ def test_load_corpus_file_non_existent(self):
158164
self.assertFalse(os.path.exists(file_path))
159165
with self.assertRaises(IOError):
160166
corpus = self.corpus.load_corpus(file_path)
167+
168+
def test_load_corpus_english_greetings(self):
169+
file_path = os.path.join(self.corpus.data_directory, 'english', 'greetings.yml')
170+
171+
corpus = self.corpus.load_corpus(file_path)
172+
173+
self.assertEqual(len(corpus), 1)
174+
175+
def test_load_corpus_english(self):
176+
file_path = os.path.join(self.corpus.data_directory, 'english')
177+
178+
corpus = self.corpus.load_corpus(file_path)
179+
180+
self.assertGreater(len(corpus), 1)
181+
182+
def test_load_corpus_english_trailing_slash(self):
183+
file_path = os.path.join(self.corpus.data_directory, 'english') + '/'
184+
185+
corpus = self.corpus.load_corpus(file_path)
186+
187+
self.assertGreater(len(corpus), 1)

0 commit comments

Comments
 (0)