Fix tests for previous commit

This commit is contained in:
Oleh Prypin
2022-10-14 00:41:56 +02:00
parent 6b7d0a55e0
commit 64c42a6943
3 changed files with 8 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ class NoBabelExtension(InternationalizationExtension): # pragma: no cover
)
def parse_locale(locale: str) -> Locale:
def parse_locale(locale) -> Locale:
try:
return Locale.parse(locale, sep='_')
except (ValueError, UnknownLocaleError, TypeError) as e:

View File

@@ -108,6 +108,7 @@ class ConfigTests(unittest.TestCase):
'dirs': [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir],
'static_templates': ['404.html', 'sitemap.xml'],
'vars': {
'name': 'mkdocs',
'locale': parse_locale('en'),
'include_search_page': False,
'search_index_only': False,
@@ -124,6 +125,7 @@ class ConfigTests(unittest.TestCase):
'dirs': [os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir],
'static_templates': ['404.html', 'sitemap.xml'],
'vars': {
'name': 'readthedocs',
'locale': parse_locale('en'),
'include_search_page': True,
'search_index_only': False,
@@ -143,6 +145,7 @@ class ConfigTests(unittest.TestCase):
'dirs': [os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir],
'static_templates': ['404.html', 'sitemap.xml'],
'vars': {
'name': 'readthedocs',
'locale': parse_locale('en'),
'include_search_page': True,
'search_index_only': False,
@@ -161,12 +164,13 @@ class ConfigTests(unittest.TestCase):
{
'dirs': [mytheme, mkdocs_templates_dir],
'static_templates': ['sitemap.xml'],
'vars': {'locale': parse_locale('en')},
'vars': {'name': None, 'locale': parse_locale('en')},
},
{
'dirs': [custom, os.path.join(theme_dir, 'readthedocs'), mkdocs_templates_dir],
'static_templates': ['404.html', 'sitemap.xml'],
'vars': {
'name': 'readthedocs',
'locale': parse_locale('en'),
'include_search_page': True,
'search_index_only': False,
@@ -186,6 +190,7 @@ class ConfigTests(unittest.TestCase):
'dirs': [os.path.join(theme_dir, 'mkdocs'), mkdocs_templates_dir],
'static_templates': ['404.html', 'sitemap.xml', 'foo.html'],
'vars': {
'name': 'mkdocs',
'locale': parse_locale('fr'),
'show_sidebar': False,
'some_var': 'bar',

View File

@@ -29,6 +29,7 @@ class ThemeTests(unittest.TestCase):
self.assertEqual(
get_vars(theme),
{
'name': 'mkdocs',
'locale': parse_locale('en'),
'include_search_page': False,
'search_index_only': False,