aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_apis.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2014-09-25 22:26:07 -0400
committerWaylan Limberg <waylan@gmail.com>2014-09-25 22:26:07 -0400
commit8f878c37dc3613b7279a0787bdcaf2d66b348d74 (patch)
treee49cbfe51f1d180ae22af9e6c33e92ca11fbd609 /tests/test_apis.py
parent39c8c1c64fe04bbde625b314386cb109b11527da (diff)
downloadmarkdown-8f878c37dc3613b7279a0787bdcaf2d66b348d74.tar.gz
markdown-8f878c37dc3613b7279a0787bdcaf2d66b348d74.tar.bz2
markdown-8f878c37dc3613b7279a0787bdcaf2d66b348d74.zip
Added a temp workwround for deprecated short ext names.
As we chnaged the order in import trys for short names extensions (no dot syntax), an extra test was added to the import code for the occassion when a naming conflict exists. For example, if PyTables is installed (module name is tables) and the user tries to use the short name 'tables' instead of 'markdown.extensions.tables'. Fixes #341. Of course, this code will get ripped out when the old behavior is fully deprecated.
Diffstat (limited to 'tests/test_apis.py')
-rw-r--r--tests/test_apis.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py
index 34cd6f0..8cb2c66 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -289,25 +289,22 @@ class TestErrors(unittest.TestCase):
def testLoadBadExtension(self):
""" Test loading of an Extension with no makeExtension function. """
- _create_fake_extension(name='fake_a', has_factory_func=False)
- self.assertRaises(AttributeError, markdown.Markdown, extensions=['fake_a'])
+ self.assertRaises(AttributeError, markdown.Markdown, extensions=['markdown.util'])
def testNonExtension(self):
""" Test loading a non Extension object as an extension. """
- _create_fake_extension(name='fake_b', is_wrong_type=True)
- self.assertRaises(TypeError, markdown.Markdown, extensions=['fake_b'])
+ self.assertRaises(TypeError, markdown.Markdown, extensions=[object])
def testBaseExtention(self):
""" Test that the base Extension class will raise NotImplemented. """
- _create_fake_extension(name='fake_c')
self.assertRaises(NotImplementedError,
- markdown.Markdown, extensions=['fake_c'])
+ markdown.Markdown, extensions=[markdown.extensions.Extension()])
def testMdxExtention(self):
""" Test that appending mdx_ raises a PendingDeprecationWarning. """
- _create_fake_extension(name='fake_d', use_old_style=True)
+ _create_fake_extension(name='fake', use_old_style=True)
self.assertRaises(PendingDeprecationWarning,
- markdown.Markdown, extensions=['fake_d'])
+ markdown.Markdown, extensions=['fake'])
def testShortNameExtention(self):
""" Test that using a short name raises a PendingDeprecationWarning. """
@@ -645,4 +642,4 @@ class TestCliOptionParsing(unittest.TestCase):
PLACE_MARKER= ~~~footnotes~~~
"""
self.create_config_file(config)
- self.assertRaises(yaml.YAMLError, parse_options, ['-c', self.tempfile]) \ No newline at end of file
+ self.assertRaises(yaml.YAMLError, parse_options, ['-c', self.tempfile])