summaryrefslogtreecommitdiff
path: root/tests/test_apis.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_apis.py')
-rw-r--r--tests/test_apis.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py
index 20144e4..a9fa770 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -1004,3 +1004,42 @@ Some +test+ and a [+link+](http://test.com)
self.md.reset()
self.assertEqual(self.md.convert(test), result)
+
+
+class TestGeneralDeprecations(unittest.TestCase):
+ """Test general deprecations."""
+
+ def test_version_deprecation(self):
+ """Test that version is deprecated."""
+
+ with warnings.catch_warnings(record=True) as w:
+ # Cause all warnings to always be triggered.
+ warnings.simplefilter("always")
+ # Trigger a warning.
+ version = markdown.version
+ # Verify some things
+ self.assertTrue(len(w) == 1)
+ self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
+ self.assertEqual(version, markdown.__version__)
+
+ def test_version_info_deprecation(self):
+ """Test that version info is deprecated."""
+
+ with warnings.catch_warnings(record=True) as w:
+ # Cause all warnings to always be triggered.
+ warnings.simplefilter("always")
+ # Trigger a warning.
+ version_info = markdown.version_info
+ # Verify some things
+ self.assertTrue(len(w) == 1)
+ self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
+ self.assertEqual(version_info, markdown.__version_info__)
+
+ def test_deprecation_wrapper_dir(self):
+ """Tests the `__dir__` attribute of the class as it replaces the module's."""
+
+ dir_attr = dir(markdown)
+ self.assertTrue('version' in dir_attr)
+ self.assertTrue('__version__' in dir_attr)
+ self.assertTrue('version_info' in dir_attr)
+ self.assertTrue('__version_info__' in dir_attr)