class_docstr: Provided a file, it should read it, replace the default values,
  append new values to the settings (if any), and apply basic settings
  optimizations.
class_docstr_tok: ["Provided","a","file",",","it","should","read","it",",","replace","the","default","values",",","append","new","values","to","the","settings","(","if","any",")",",","and","apply","basic","settings","optimizations","."]
code: def test_deprecated_slug_substitutions(self):
      default_slug_regex_subs = self.settings[
          "SLUG_REGEX_SUBSTITUTIONS"
      ]
  
      # If no deprecated setting is set, don't set new ones
      settings = {}
      settings = handle_deprecated_settings(settings)
      self.assertNotIn("SLUG_REGEX_SUBSTITUTIONS", settings)
      self.assertNotIn("TAG_REGEX_SUBSTITUTIONS", settings)
      self.assertNotIn("CATEGORY_REGEX_SUBSTITUTIONS", settings)
      self.assertNotIn("AUTHOR_REGEX_SUBSTITUTIONS", settings)
  
      # If SLUG_SUBSTITUTIONS is set, set {SLUG, AUTHOR}_REGEX_SUBSTITUTIONS
      # correctly, don't set {CATEGORY, TAG}_REGEX_SUBSTITUTIONS
      settings = {}
      settings["SLUG_SUBSTITUTIONS"] = [("C++", "cpp")]
      settings = handle_deprecated_settings(settings)
      self.assertEqual(
          settings.get("SLUG_REGEX_SUBSTITUTIONS"),
          [(r"C\+\+", "cpp")] + default_slug_regex_subs,
      )
      self.assertNotIn("TAG_REGEX_SUBSTITUTIONS", settings)
      self.assertNotIn("CATEGORY_REGEX_SUBSTITUTIONS", settings)
      self.assertEqual(
          settings.get("AUTHOR_REGEX_SUBSTITUTIONS"),
          default_slug_regex_subs,
      )
  
      # If {CATEGORY, TAG, AUTHOR}_SUBSTITUTIONS are set, set
      # {CATEGORY, TAG, AUTHOR}_REGEX_SUBSTITUTIONS correctly, don't set
      # SLUG_REGEX_SUBSTITUTIONS
      settings = {}
      settings["TAG_SUBSTITUTIONS"] = [("C#", "csharp")]
      settings["CATEGORY_SUBSTITUTIONS"] = [("C#", "csharp")]
      settings["AUTHOR_SUBSTITUTIONS"] = [
          ("Alexander Todorov", "atodorov")
      ]
      settings = handle_deprecated_settings(settings)
      self.assertNotIn("SLUG_REGEX_SUBSTITUTIONS", settings)
      self.assertEqual(
          settings["TAG_REGEX_SUBSTITUTIONS"],
          [(r"C\#", "csharp")] + default_slug_regex_subs,
      )
      self.assertEqual(
          settings["CATEGORY_REGEX_SUBSTITUTIONS"],
          [(r"C\#", "csharp")] + default_slug_regex_subs,
      )
      self.assertEqual(
          settings["AUTHOR_REGEX_SUBSTITUTIONS"],
          [(r"Alexander\ Todorov", "atodorov")]
          + default_slug_regex_subs,
      )
  
      # If {SLUG, CATEGORY, TAG, AUTHOR}_SUBSTITUTIONS are set, set
      # {SLUG, CATEGORY, TAG, AUTHOR}_REGEX_SUBSTITUTIONS correctly
      settings = {}
      settings["SLUG_SUBSTITUTIONS"] = [("C++", "cpp")]
      settings["TAG_SUBSTITUTIONS"] = [("C#", "csharp")]
      settings["CATEGORY_SUBSTITUTIONS"] = [("C#", "csharp")]
      settings["AUTHOR_SUBSTITUTIONS"] = [
          ("Alexander Todorov", "atodorov")
      ]
      settings = handle_deprecated_settings(settings)
      self.assertEqual(
          settings["TAG_REGEX_SUBSTITUTIONS"],
          [(r"C\+\+", "cpp")]
          + [(r"C\#", "csharp")]
          + default_slug_regex_subs,
      )
      self.assertEqual(
          settings["CATEGORY_REGEX_SUBSTITUTIONS"],
          [(r"C\+\+", "cpp")]
          + [(r"C\#", "csharp")]
          + default_slug_regex_subs,
      )
      self.assertEqual(
          settings["AUTHOR_REGEX_SUBSTITUTIONS"],
          [(r"Alexander\ Todorov", "atodorov")]
          + default_slug_regex_subs,
      )
  
      # Handle old 'skip' flags correctly
      settings = {}
      settings["SLUG_SUBSTITUTIONS"] = [("C++", "cpp", True)]
      settings["AUTHOR_SUBSTITUTIONS"] = [
          ("Alexander Todorov", "atodorov", False)
      ]
      settings = handle_deprecated_settings(settings)
      self.assertEqual(
          settings.get("SLUG_REGEX_SUBSTITUTIONS"),
          [(r"C\+\+", "cpp")]
          + [(r"(?u)\A\s*", ""), (r"(?u)\s*\Z", "")],
      )
      self.assertEqual(
          settings["AUTHOR_REGEX_SUBSTITUTIONS"],
          [(r"Alexander\ Todorov", "atodorov")]
          + default_slug_regex_subs,
      )
  
imports: import copy
  import locale
  import os
  from os.path import abspath, dirname, join
  from pelican.settings import DEFAULT_CONFIG, DEFAULT_THEME, _printf_s_to_format_field, configure_settings, handle_deprecated_settings, read_settings
  from pelican.tests.support import unittest
label_desc: Use image node_id 21 for calling the TestSettingsConfiguration obj's underlying member method code with example usage: obj.test_deprecated_slug_substitutions() without return types