diff options
author | 2025-01-01 13:46:43 +0000 | |
---|---|---|
committer | 2025-01-01 13:46:43 +0000 | |
commit | 2246207c5e8b439b1aaee216cef672b530e8bfa3 (patch) | |
tree | acb1e9fa15d235a9c943f2803c2a8f43ea249211 /tests | |
parent | Bump ruff from 0.8.0 to 0.8.4 (#3220) (diff) | |
parent | Fix rendering of markdown headers in docs (diff) |
Bump markdownify from 0.13.1 to 0.14.1 (#3205)
* Bump markdownify from 0.13.1 to 0.14.1
Bumps [markdownify](https://github.com/matthewwithanm/python-markdownify) from 0.13.1 to 0.14.1.
- [Release notes](https://github.com/matthewwithanm/python-markdownify/releases)
- [Commits](https://github.com/matthewwithanm/python-markdownify/compare/0.13.1...0.14.1)
---
updated-dependencies:
- dependency-name: markdownify
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
* Remove surrounding whitespace from doc description markdown
* Fix rendering of markdown headers in docs
---------
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: wookie184 <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bot/exts/info/doc/test_parsing.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/bot/exts/info/doc/test_parsing.py b/tests/bot/exts/info/doc/test_parsing.py index d2105a53c..7136fc32c 100644 --- a/tests/bot/exts/info/doc/test_parsing.py +++ b/tests/bot/exts/info/doc/test_parsing.py @@ -1,5 +1,7 @@ from unittest import TestCase +from bs4 import BeautifulSoup + from bot.exts.info.doc import _parsing as parsing from bot.exts.info.doc._markdown import DocMarkdownConverter @@ -87,3 +89,19 @@ class MarkdownConverterTest(TestCase): with self.subTest(input_string=input_string): d = DocMarkdownConverter(page_url="https://example.com") self.assertEqual(d.convert(input_string), expected_output) + + +class MarkdownCreationTest(TestCase): + def test_surrounding_whitespace(self): + test_cases = ( + ("<p>Hello World</p>", "Hello World"), + ("<p>Hello</p><p>World</p>", "Hello\n\nWorld"), + ("<h1>Title</h1>", "**Title**") + ) + self._run_tests(test_cases) + + def _run_tests(self, test_cases: tuple[tuple[str, str], ...]): + for input_string, expected_output in test_cases: + with self.subTest(input_string=input_string): + tags = BeautifulSoup(input_string, "html.parser") + self.assertEqual(parsing._create_markdown(None, tags, "https://example.com"), expected_output) |