From 961e7f8bbdb1640a653ac2af032c0a3ce59a82e2 Mon Sep 17 00:00:00 2001 From: jhn27 Date: Thu, 18 Apr 2024 14:36:26 +1200 Subject: [PATCH] Add test containing both open and close brackets in external link --- verto/tests/ExternalLinkTest.py | 11 +++++++++++ verto/tests/assets/external-link/both_brackets.md | 1 + .../assets/external-link/both_brackets_expected.html | 1 + 3 files changed, 13 insertions(+) create mode 100644 verto/tests/assets/external-link/both_brackets.md create mode 100644 verto/tests/assets/external-link/both_brackets_expected.html diff --git a/verto/tests/ExternalLinkTest.py b/verto/tests/ExternalLinkTest.py index 8f300e5d..e1d0f850 100644 --- a/verto/tests/ExternalLinkTest.py +++ b/verto/tests/ExternalLinkTest.py @@ -206,6 +206,17 @@ def test_trailing_question_mark(self): expected_string = self.read_test_file(self.processor_name, 'trailing_question_mark_expected.html', strip=True).strip() self.assertEqual(expected_string, converted_test_string) + def test_both_brackets(self): + '''Tests path containing both ().''' + test_string = self.read_test_file(self.processor_name, 'both_brackets.md') + + processor = ExternalLinkPattern(self.ext, self.md.parser) + self.assertIsNotNone(re.search(processor.compiled_re, test_string)) + + converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension]) + expected_string = self.read_test_file(self.processor_name, 'both_brackets_expected.html', strip=True).strip() + self.assertEqual(expected_string, converted_test_string) + def test_multiple_links(self): '''Tests that multiple links are processed.''' test_string = self.read_test_file(self.processor_name, 'multiple_links.md') diff --git a/verto/tests/assets/external-link/both_brackets.md b/verto/tests/assets/external-link/both_brackets.md new file mode 100644 index 00000000..4377ca7a --- /dev/null +++ b/verto/tests/assets/external-link/both_brackets.md @@ -0,0 +1 @@ +Check out this [website](https://en.wikipedia.org/wiki/Entropy_(information_theory)). diff --git a/verto/tests/assets/external-link/both_brackets_expected.html b/verto/tests/assets/external-link/both_brackets_expected.html new file mode 100644 index 00000000..4b90f187 --- /dev/null +++ b/verto/tests/assets/external-link/both_brackets_expected.html @@ -0,0 +1 @@ +

Check out this website.