Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_toc_tokens fails with markdown >= 3.6 #2343

Closed
mgorny opened this issue Mar 26, 2024 · 2 comments · Fixed by #2344
Labels
C: infrastructure Related to project infrastructure. S: triage Issue needs triage. T: bug Bug.

Comments

@mgorny
Copy link

mgorny commented Mar 26, 2024

Description

After upgrading markdown to 3.6, the following test is failing:

========================================================= test session starts =========================================================
platform linux -- Python 3.11.8, pytest-8.1.1, pluggy-1.4.0 -- /tmp/pymdown-extensions/.venv/bin/python
cachedir: .pytest_cache
rootdir: /tmp/pymdown-extensions
configfile: pyproject.toml
collected 11 items                                                                                                                    

tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_copyright PASSED                                             [  9%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_double_arrow PASSED                                          [ 18%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_fractions PASSED                                             [ 27%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_left PASSED                                                  [ 36%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_neq PASSED                                                   [ 45%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_ordinals PASSED                                              [ 54%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_plus_minus PASSED                                            [ 63%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_registered PASSED                                            [ 72%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_right PASSED                                                 [ 81%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_toc_tokens FAILED                                            [ 90%]
tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_trademark PASSED                                             [100%]

============================================================== FAILURES ===============================================================
__________________________________________________ TestSmartSymbols.test_toc_tokens ___________________________________________________

self = <tests.test_extensions.test_smartsymbols.TestSmartSymbols testMethod=test_toc_tokens>

    def test_toc_tokens(self):
        """Ensure smart symbols end up correctly in table of content tokens."""
    
        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': []}])
E       AssertionError: Lists differ: [{'le[46 chars]r', 'html': '<em>Foo</em> &ne; <code>bar</code[37 chars] []}] != [{'le[46 chars]r', 'children': []}]
E       
E       First differing element 0:
E       {'lev[45 chars]r', 'html': '<em>Foo</em> &ne; <code>bar</code[36 chars]: []}
E       {'lev[45 chars]r', 'children': []}
E       
E       + [{'children': [], 'id': 'foo-bar', 'level': 1, 'name': 'Foo &ne; bar'}]
E       - [{'children': [],
E       -   'data-toc-label': '',
E       -   'html': '<em>Foo</em> &ne; <code>bar</code>',
E       -   'id': 'foo-bar',
E       -   'level': 1,
E       -   'name': 'Foo &ne; bar'}]

tests/test_extensions/test_smartsymbols.py:142: AssertionError
======================================================= short test summary info =======================================================
FAILED tests/test_extensions/test_smartsymbols.py::TestSmartSymbols::test_toc_tokens - AssertionError: Lists differ: [{'le[46 chars]r', 'html': '<em>Foo</em> &ne; <code>bar</code[37 chars] []}] != [{'le[46 chars]r', '...
==================================================== 1 failed, 10 passed in 0.13s =====================================================

Minimal Reproduction

pip install -U markdown
python -m pytest -vv tests/test_extensions/test_smartsymbols.py

Version(s) & System Info

  • Operating System: Gentoo Linux amd64
  • Python Version: 3.11.8
  • Package Version: 10.7.1 (87e649d)
@mgorny mgorny added the T: bug Bug. label Mar 26, 2024
@gir-bot gir-bot added the S: triage Issue needs triage. label Mar 26, 2024
facelessuser added a commit that referenced this issue Mar 26, 2024
@facelessuser
Copy link
Owner

Thanks for pointing this out! Test fix is on the way.

@facelessuser facelessuser added the C: infrastructure Related to project infrastructure. label Mar 26, 2024
facelessuser added a commit that referenced this issue Mar 26, 2024
@mgorny
Copy link
Author

mgorny commented Mar 26, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: infrastructure Related to project infrastructure. S: triage Issue needs triage. T: bug Bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants