diff options
author | Waylan Limberg <waylan@gmail.com> | 2014-08-29 20:00:39 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2014-08-29 20:00:39 -0400 |
commit | 9a5b11116e2ea8a240fa2d03cad9de334023da9d (patch) | |
tree | b40a5fcd3f65c22a891577cce28247d2355ddfa2 /tests | |
parent | e11a15531b5bd2d3ca2636e624ac377471b294e0 (diff) | |
download | markdown-9a5b11116e2ea8a240fa2d03cad9de334023da9d.tar.gz markdown-9a5b11116e2ea8a240fa2d03cad9de334023da9d.tar.bz2 markdown-9a5b11116e2ea8a240fa2d03cad9de334023da9d.zip |
Mark special treatment of extension names as PendingDeprecation
The builtin extensions will no longer get special treatment and have
the path ("markdown.extensions.") appended . The same applies for
"mdx_" extensions. All names extension must provide the full path.
Fixes #336.
Also deprecating support for passing in extension config settings
as part of the string name. The extension_configs keyword should
be used instead. Fixes #335.
Also raising PendingDeprecationWarnings for positional args or the
"config" keyword on the Extension Class. Pass each setting as a
seperate keyword instead.
Docs and tests are updated. Still need to update extension API docs.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_apis.py | 20 | ||||
-rw-r--r-- | tests/test_extensions.py | 16 |
2 files changed, 15 insertions, 21 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py index 010bf70..b19db62 100644 --- a/tests/test_apis.py +++ b/tests/test_apis.py @@ -303,14 +303,24 @@ class TestErrors(unittest.TestCase): self.assertRaises(NotImplementedError, markdown.Markdown, extensions=['fake_c']) - def testDotSyntaxExtention(self): - """ Test that dot syntax imports properly (not using mdx_). """ - _create_fake_extension(name='fake_d', use_old_style=False) - self.assertRaises(NotImplementedError, + def testMdxExtention(self): + """ Test that appending mdx_ raises a PendingDeprecationWarning. """ + _create_fake_extension(name='fake_d', use_old_style=True) + self.assertRaises(PendingDeprecationWarning, markdown.Markdown, extensions=['fake_d']) + def testShortNameExtention(self): + """ Test that using a short name raises a PendingDeprecationWarning. """ + self.assertRaises(PendingDeprecationWarning, + markdown.Markdown, extensions=['footnotes']) + + def testStringConfigExtention(self): + """ Test that passing configs to an Extension in the name raises a PendingDeprecationWarning. """ + self.assertRaises(PendingDeprecationWarning, + markdown.Markdown, extensions=['markdown.extension.footnotes(PLACE_MARKER=FOO)']) + -def _create_fake_extension(name, has_factory_func=True, is_wrong_type=False, use_old_style=True): +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]) diff --git a/tests/test_extensions.py b/tests/test_extensions.py index a7be627..a21fd94 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -47,22 +47,6 @@ class TestExtensionClass(unittest.TestCase): # self.ext.setConfig('bad', 'baz) ==> KeyError self.assertRaises(KeyError, self.ext.setConfig, 'bad', 'baz') - def testConfigAsArgListOnInit(self): - ext = self.ExtKlass([('foo', 'baz'), ('bar', 'blah')]) - self.assertEqual(ext.getConfigs(), {'foo': 'baz', 'bar': 'blah'}) - - def testConfigAsArgDictOnInit(self): - ext = self.ExtKlass({'foo': 'baz', 'bar': 'blah', 'bar': 'blah'}) - self.assertEqual(ext.getConfigs(), {'foo': 'baz', 'bar': 'blah'}) - - def testConfigAsKwargListOnInit(self): - ext = self.ExtKlass(configs=[('foo', 'baz'), ('bar', 'blah')]) - self.assertEqual(ext.getConfigs(), {'foo': 'baz', 'bar': 'blah'}) - - def testConfigAsKwargDictOnInit(self): - ext = self.ExtKlass(configs={'foo': 'baz', 'bar': 'blah'}) - self.assertEqual(ext.getConfigs(), {'foo': 'baz', 'bar': 'blah'}) - def testConfigAsKwargsOnInit(self): ext = self.ExtKlass(foo='baz', bar='blah') self.assertEqual(ext.getConfigs(), {'foo': 'baz', 'bar': 'blah'}) |