commit:     e7832613369bd45cc3e0d9ec92267b1d7cdf2c09
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 26 12:51:06 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Mar 26 12:51:45 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7832613

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

Closes: https://bugs.gentoo.org/927812
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/pymdown-extensions-10.7.1-md36.patch     | 49 ++++++++++++++++++++++
 .../pymdown-extensions-10.7.1.ebuild               |  5 +++
 2 files changed, 54 insertions(+)

diff --git 
a/dev-python/pymdown-extensions/files/pymdown-extensions-10.7.1-md36.patch 
b/dev-python/pymdown-extensions/files/pymdown-extensions-10.7.1-md36.patch
new file mode 100644
index 000000000000..5c914923e6cc
--- /dev/null
+++ b/dev-python/pymdown-extensions/files/pymdown-extensions-10.7.1-md36.patch
@@ -0,0 +1,49 @@
+From 509e93de0f4d6052ff017a543aff70eb354dc590 Mon Sep 17 00:00:00 2001
+From: Isaac Muse <[email protected]>
+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': []
++                }
++            ]
++        )

diff --git a/dev-python/pymdown-extensions/pymdown-extensions-10.7.1.ebuild 
b/dev-python/pymdown-extensions/pymdown-extensions-10.7.1.ebuild
index 69a0a4e1cc22..b81baf88a509 100644
--- a/dev-python/pymdown-extensions/pymdown-extensions-10.7.1.ebuild
+++ b/dev-python/pymdown-extensions/pymdown-extensions-10.7.1.ebuild
@@ -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

Reply via email to