aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_apis.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_apis.py')
-rw-r--r--tests/test_apis.py49
1 files changed, 6 insertions, 43 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py
index 6a1829b..42e7496 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -11,7 +11,6 @@ from __future__ import unicode_literals
import unittest
import sys
import os
-import types
import markdown
import warnings
from markdown.__main__ import parse_options
@@ -46,11 +45,15 @@ class TestMarkdownBasics(unittest.TestCase):
from markdown.extensions.footnotes import FootnoteExtension
markdown.Markdown(extensions=[FootnoteExtension()])
- def testNamedExtension(self):
+ def testEntryPointExtension(self):
+ """ Test Extension loading with an entry point. """
+ markdown.Markdown(extensions=['footnotes'])
+
+ def testDotNotationExtension(self):
""" Test Extension loading with Name (`path.to.module`). """
markdown.Markdown(extensions=['markdown.extensions.footnotes'])
- def TestNamedExtensionWithClass(self):
+ def TestDotNotationExtensionWithClass(self):
""" Test Extension loading with class name (`path.to.module:Class`). """
markdown.Markdown(extensions=['markdown.extensions.footnotes:FootnoteExtension'])
@@ -343,46 +346,6 @@ class TestErrors(unittest.TestCase):
markdown.Markdown, extensions=[markdown.extensions.Extension()]
)
- def testMdxExtention(self):
- """ Test that prepending mdx_ raises a DeprecationWarning. """
- _create_fake_extension(name='fake', use_old_style=True)
- self.assertRaises(
- DeprecationWarning,
- markdown.Markdown, extensions=['fake']
- )
-
- def testShortNameExtention(self):
- """ Test that using a short name raises a DeprecationWarning. """
- self.assertRaises(
- DeprecationWarning,
- markdown.Markdown, extensions=['footnotes']
- )
-
-
-def _create_fake_extension(name, has_factory_func=True, is_wrong_type=False, use_old_style=False):
- """ Create a fake extension module for testing. """
- if use_old_style:
- mod_name = '_'.join(['mdx', name])
- else:
- mod_name = name
- if not PY3:
- # mod_name must be bytes in Python 2.x
- mod_name = bytes(mod_name)
- ext_mod = types.ModuleType(mod_name)
-
- def makeExtension(*args, **kwargs):
- if is_wrong_type:
- return object
- else:
- return markdown.extensions.Extension(*args, **kwargs)
-
- if has_factory_func:
- ext_mod.makeExtension = makeExtension
- # Warning: this brute forces the extenson module onto the system. Either
- # this needs to be specificly overriden or a new python session needs to
- # be started to get rid of this. This should be ok in a testing context.
- sys.modules[mod_name] = ext_mod
-
class testETreeComments(unittest.TestCase):
"""