# Path: chirp/library/titles.py
# _NOT_OPEN_OR_CLOSE_TAG = r"[^\[\]]"
# _NOT_CLOSE_TAG = r"[^\]]"
# _TEXT_RE = re.compile("".join((
#             r"^",
#             # The main part of the title
#             _NOT_OPEN_OR_CLOSE_TAG, "+",
#             # Zero or more tags, including leading whitespace
#             r"(\s\[", _NOT_CLOSE_TAG, "+\])*",
#             r"$")))
# _TAG_RE = re.compile(r"\[(" + _NOT_CLOSE_TAG + "+)\]")
# def standardize(text):
# def append(text, to_append):
# def split_tags(text):


import unittest
from chirp.library import titles
            ("Foo [Tag][Tag]", "Foo [Tag] [Tag]"),
            ("Foo[Tag]", "Foo [Tag]"),
            # Check quote handling
            (u"Don\u2019t Worry", "Don't Worry"),
            ("Name [7'']", 'Name [7"]'),
            (u"Name [7\u201d]", 'Name [7"]'),
            ):
            self.assertEqual(expected_standardization,
                             titles.standardize(raw_text))

        # Check that we reject malformed text.
        for bad_text in (
            "Unbalanced [", "Unbalanced ]",
            "Unbalanced [Foo", "Unbalanced [Foo] Bar]",
            "Nested [Foo [Bar]]",
            "Empty Tag []",
            "Foo [No Interior Tags] Bar",
            ):
            self.assertEqual(None, titles.standardize(bad_text))

    def test_append(self):
        for orig_text, to_append, expected_text in (
            ("Foo", "Bar", "FooBar"),
            ("Foo [Tag]", "Bar", "FooBar [Tag]"),
            ):
            self.assertEqual(expected_text,
                             titles.append(orig_text, to_append))

    def test_split_tags(self):
        self.assertEqual(("Foo", []),

# Path: chirp/library/titles.py
# _NOT_OPEN_OR_CLOSE_TAG = r"[^\[\]]"
# _NOT_CLOSE_TAG = r"[^\]]"
# _TEXT_RE = re.compile("".join((
#             r"^",
#             # The main part of the title
#             _NOT_OPEN_OR_CLOSE_TAG, "+",
#             # Zero or more tags, including leading whitespace
#             r"(\s\[", _NOT_CLOSE_TAG, "+\])*",
#             r"$")))
# _TAG_RE = re.compile(r"\[(" + _NOT_CLOSE_TAG + "+)\]")
# def standardize(text):
# def append(text, to_append):
# def split_tags(text):


# Path: chirp/library/titles_test.py
import unittest
from chirp.library import titles

            ("Foo [Tag][Tag]", "Foo [Tag] [Tag]"),
            ("Foo[Tag]", "Foo [Tag]"),
            # Check quote handling
            (u"Don\u2019t Worry", "Don't Worry"),
            ("Name [7'']", 'Name [7"]'),
            (u"Name [7\u201d]", 'Name [7"]'),
            ):
            self.assertEqual(expected_standardization,
                             titles.standardize(raw_text))

        # Check that we reject malformed text.
        for bad_text in (
            "Unbalanced [", "Unbalanced ]",
            "Unbalanced [Foo", "Unbalanced [Foo] Bar]",
            "Nested [Foo [Bar]]",
            "Empty Tag []",
            "Foo [No Interior Tags] Bar",
            ):
            self.assertEqual(None, titles.standardize(bad_text))

    def test_append(self):
        for orig_text, to_append, expected_text in (
            ("Foo", "Bar", "FooBar"),
            ("Foo [Tag]", "Bar", "FooBar [Tag]"),
            ):
            self.assertEqual(expected_text,
                             titles.append(orig_text, to_append))

    def test_split_tags(self):
        self.assertEqual(("Foo", []),

                         titles.split_tags("Foo"))