Skip to content

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

@mgorny

Description

@mgorny

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions