test __init__ for missing/wrong type SourceDocument

This commit is contained in:
Martin A. Brown 2016-02-12 23:59:44 -08:00
parent 82a8a21d18
commit 336faa4df5
1 changed files with 14 additions and 0 deletions

View File

@ -44,5 +44,19 @@ class TestInvalidSources(TestSources):
self.assertEquals(0, len(s.docs))
class TestMissingSourceDocuments(TestSources):
def test_init_missing(self):
missing = os.path.join(self.tempdir, 'vanishing')
with self.assertRaises(OSError) as ecm:
SourceDocument(missing)
e = ecm.exception
self.assertTrue('Missing' in e.message)
with self.assertRaises(OSError) as ecm:
SourceDocument(self.tempdir)
e = ecm.exception
self.assertTrue('Wrong type' in e.message)
#
# -- end of file