diff --git a/language_tags/tags.py b/language_tags/tags.py index d91fe75..3c5359e 100644 --- a/language_tags/tags.py +++ b/language_tags/tags.py @@ -81,7 +81,7 @@ def search(description, all=False): """ Gets a list of :class:`language_tags.Subtag.Subtag` objects where the description matches. - :param description: a string or compiled regular expression. For example: ``search(re.compile('\d{4}'))`` if the + :param description: a string or compiled regular expression. For example: ``search(re.compile(r'\d{4}'))`` if the description of the returned subtag must contain four contiguous numerical digits. :type description: str or RegExp :param all: If set on True grandfathered and redundant tags will be included in the return diff --git a/tests/test_tags.py b/tests/test_tags.py index 0c40ec5..bcf06d2 100644 --- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -64,7 +64,7 @@ def test_search_exact_match(self): self.assertEqual(subtags[0].format, 'prs') def test_search_regexp(self): - subtags = tags.search(re.compile('\d{4}')) + subtags = tags.search(re.compile(r/'\d{4}')) self.assertGreater(len(subtags), 0) def test_type(self): @@ -99,7 +99,7 @@ def test_languages(self): self.assertIn('\'en\' is not a macrolanguage.', context.exception.args) def test_date(self): - self.assertIsNotNone(re.compile('\d{4}\-\d{2}\-\d{2}').search(tags.date())) + self.assertIsNotNone(re.compile(r'\d{4}\-\d{2}\-\d{2}').search(tags.date())) def test_description(self): description = tags.description('nl-BE')