From 4c3b6ac383115be4f6664d0e6389cdffd310b926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 11 Nov 2018 00:17:00 +0100 Subject: [PATCH] settings: add another consistency test for SLUG_SUBSTITUTIONS. --- pelican/tests/test_settings.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pelican/tests/test_settings.py b/pelican/tests/test_settings.py index bb05e2ae..a92cf09c 100644 --- a/pelican/tests/test_settings.py +++ b/pelican/tests/test_settings.py @@ -285,3 +285,14 @@ class TestSettingsConfiguration(unittest.TestCase): self.assertEqual(settings['AUTHOR_REGEX_SUBSTITUTIONS'], [(r'Alexander\ Todorov', 'atodorov')] + default_slug_regex_subs) + + def test_deprecated_slug_substitutions_from_file(self): + # This is equivalent to reading a settings file that has + # SLUG_SUBSTITUTIONS defined but no SLUG_REGEX_SUBSTITUTIONS. + settings = read_settings(None, override={ + 'SLUG_SUBSTITUTIONS': [('C++', 'cpp')] + }) + self.assertEqual(settings['SLUG_REGEX_SUBSTITUTIONS'], + [(r'C\+\+', 'cpp')] + + self.settings['SLUG_REGEX_SUBSTITUTIONS']) + self.assertNotIn('SLUG_SUBSTITUTIONS', settings)