1
0
Fork 0
forked from github/pelican

Add test for the case where we try to read a file with an unhandled extension

This commit is contained in:
Dominique Plante 2013-05-23 21:53:46 -07:00
commit 7a3bc410d0
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,12 @@
This is a super article !
#########################
:tags: foo, bar, foobar
:date: 2010-12-02 10:14
:category: yeah
:author: Alexis Métaireau
:summary:
Multi-line metadata should be supported
as well as **inline markup**.
:custom_field: http://notmyidea.org

View file

@ -14,6 +14,17 @@ CONTENT_PATH = os.path.join(CUR_DIR, 'content')
def _path(*args): def _path(*args):
return os.path.join(CONTENT_PATH, *args) return os.path.join(CONTENT_PATH, *args)
class ReaderTests(unittest.TestCase):
def test_readfile_unknown_extension(self):
f = _path('article_with_metadata.unknownextension')
with self.assertRaises(TypeError) as cm:
readers.read_file(f)
ex = cm.exception
self.assertEqual('Pelican does not know how to parse ' + f, ex.message)
#, setattr, root.c1.c2, 'text', "test")
# self.assertTrue(1 == 0)
# except TypeError:
# self.assertTrue(1 == 1)
class RstReaderTest(unittest.TestCase): class RstReaderTest(unittest.TestCase):