# Path: mkdocs/utils/babel_stub.py
# class Locale(NamedTuple):
#     language: str
#     territory: str = ''
# 
#     def __str__(self):
#         if self.territory:
#             return f'{self.language}_{self.territory}'
#         return self.language
# 
#     @classmethod
#     def parse(cls, identifier, sep):
#         if not isinstance(identifier, str):
#             raise TypeError(f"Unexpected value for identifier: '{identifier}'")
#         locale = cls(*identifier.split(sep, 1))
#         if not all(x in ascii_letters for x in locale.language):
#             raise ValueError(f"expected only letters, got '{locale.language}'")
#         if len(locale.language) != 2:
#             raise UnknownLocaleError(f"unknown locale '{locale.language}'")
#         return locale
# 
# class UnknownLocaleError(Exception):
#     pass


import unittest
from mkdocs.utils.babel_stub import Locale, UnknownLocaleError
        self.assertEqual(locale.language, 'fr')
        self.assertEqual(locale.territory, '')
        self.assertEqual(str(locale), 'fr')

    def test_parse_locale_language_territory(self):
        locale = Locale.parse('fr_FR', '_')
        self.assertEqual(locale.language, 'fr')
        self.assertEqual(locale.territory, 'FR')
        self.assertEqual(str(locale), 'fr_FR')

    def test_parse_locale_language_territory_sep(self):
        locale = Locale.parse('fr-FR', '-')
        self.assertEqual(locale.language, 'fr')
        self.assertEqual(locale.territory, 'FR')
        self.assertEqual(str(locale), 'fr_FR')

    def test_parse_locale_bad_type(self):
        with self.assertRaises(TypeError):
            Locale.parse(['list'], '_')

    def test_parse_locale_invalid_characters(self):
        with self.assertRaises(ValueError):
            Locale.parse('42', '_')

    def test_parse_locale_bad_format(self):
        with self.assertRaises(ValueError):
            Locale.parse('en-GB', '_')

    def test_parse_locale_bad_format_sep(self):
        with self.assertRaises(ValueError):

# Path: mkdocs/utils/babel_stub.py
# class Locale(NamedTuple):
#     language: str
#     territory: str = ''
# 
#     def __str__(self):
#         if self.territory:
#             return f'{self.language}_{self.territory}'
#         return self.language
# 
#     @classmethod
#     def parse(cls, identifier, sep):
#         if not isinstance(identifier, str):
#             raise TypeError(f"Unexpected value for identifier: '{identifier}'")
#         locale = cls(*identifier.split(sep, 1))
#         if not all(x in ascii_letters for x in locale.language):
#             raise ValueError(f"expected only letters, got '{locale.language}'")
#         if len(locale.language) != 2:
#             raise UnknownLocaleError(f"unknown locale '{locale.language}'")
#         return locale
# 
# class UnknownLocaleError(Exception):
#     pass


# Path: mkdocs/tests/utils/babel_stub_tests.py
import unittest
from mkdocs.utils.babel_stub import Locale, UnknownLocaleError

        self.assertEqual(locale.language, 'fr')
        self.assertEqual(locale.territory, '')
        self.assertEqual(str(locale), 'fr')

    def test_parse_locale_language_territory(self):
        locale = Locale.parse('fr_FR', '_')
        self.assertEqual(locale.language, 'fr')
        self.assertEqual(locale.territory, 'FR')
        self.assertEqual(str(locale), 'fr_FR')

    def test_parse_locale_language_territory_sep(self):
        locale = Locale.parse('fr-FR', '-')
        self.assertEqual(locale.language, 'fr')
        self.assertEqual(locale.territory, 'FR')
        self.assertEqual(str(locale), 'fr_FR')

    def test_parse_locale_bad_type(self):
        with self.assertRaises(TypeError):
            Locale.parse(['list'], '_')

    def test_parse_locale_invalid_characters(self):
        with self.assertRaises(ValueError):
            Locale.parse('42', '_')

    def test_parse_locale_bad_format(self):
        with self.assertRaises(ValueError):
            Locale.parse('en-GB', '_')

    def test_parse_locale_bad_format_sep(self):
        with self.assertRaises(ValueError):

            Locale.parse('en_GB', '-')