dev-python/pymdown-extensions: Fix tests w/ markdown >= 3.6

Closes: https://bugs.gentoo.org/927812
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2024-03-26 13:51:06 +01:00
parent 6523ef2c99
commit e783261336
2 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
From 509e93de0f4d6052ff017a543aff70eb354dc590 Mon Sep 17 00:00:00 2001
From: Isaac Muse <faceless.shop@gmail.com>
Date: Tue, 26 Mar 2024 06:40:11 -0600
Subject: [PATCH] Fix SmartSymbols Toc test (#2344)
Fixes #2343
---
tests/test_extensions/test_smartsymbols.py | 24 +++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/tests/test_extensions/test_smartsymbols.py b/tests/test_extensions/test_smartsymbols.py
index b438fb7d7..1a8688f0c 100644
--- a/tests/test_extensions/test_smartsymbols.py
+++ b/tests/test_extensions/test_smartsymbols.py
@@ -1,6 +1,9 @@
"""Test cases for SmartSymbols."""
from .. import util
import markdown
+from pymdownx.__meta__ import parse_version
+
+PYMD_3_6 = parse_version(markdown.__version__) >= (3, 6, 0)
class TestSmartSymbols(util.MdCase):
@@ -139,4 +142,23 @@ def test_toc_tokens(self):
md = markdown.Markdown(extensions=['toc', 'pymdownx.smartsymbols'])
md.convert('# *Foo* =/= `bar`')
- self.assertEqual(md.toc_tokens, [{'level': 1, 'id': 'foo-bar', 'name': 'Foo &ne; bar', 'children': []}])
+ self.assertEqual(
+ md.toc_tokens,
+ [
+ {
+ 'children': [],
+ 'data-toc-label': '',
+ 'html': '<em>Foo</em> &ne; <code>bar</code>',
+ 'id': 'foo-bar',
+ 'level': 1,
+ 'name': 'Foo &ne; bar'
+ }
+ ] if PYMD_3_6 else [
+ {
+ 'level': 1,
+ 'id': 'foo-bar',
+ 'name': 'Foo &ne; bar',
+ 'children': []
+ }
+ ]
+ )

View File

@@ -32,6 +32,11 @@ BDEPEND="
distutils_enable_tests pytest
src_prepare() {
local PATCHES=(
# https://github.com/facelessuser/pymdown-extensions/issues/2343
"${FILESDIR}/${P}-md36.patch"
)
# broken on pypy3; unfortunately, the parametrization is based
# on indexes and these are pretty random, so we need to remove it
# entirely