eyeseast / python-frontmatter

Parse and manage posts with YAML (or other) frontmatter
http://python-frontmatter.rtfd.io
MIT License
329 stars 43 forks source link

test failure: unit_test.FrontmatterTest testMethod=test_pretty_dumping #105

Closed wookietreiber closed 1 year ago

wookietreiber commented 1 year ago
============================================================================ test session starts =============================================================================
platform linux -- Python 3.10.10, pytest-7.3.1, pluggy-1.0.0
rootdir: /tmp/makepkg/python-frontmatter/src/python-frontmatter-1.0.0
collected 59 items

tests/test_docs.py ...                                                                                                                                                 [  5%]
tests/test_files.py ......................                                                                                                                             [ 42%]
tests/unit_test.py .......F..............s....s....s.                                                                                                                  [100%]

================================================================================== FAILURES ==================================================================================
____________________________________________________________________ FrontmatterTest.test_pretty_dumping _____________________________________________________________________

self = <unit_test.FrontmatterTest testMethod=test_pretty_dumping>

    def test_pretty_dumping(self):
        "Use pyaml to dump nicer"
        # pyaml only runs on 2.7 and above
        if pyaml is not None:

            with codecs.open("tests/yaml/unpretty.md", "r", "utf-8") as f:
                data = f.read()

            post = frontmatter.load("tests/yaml/unpretty.md")
            yaml = pyaml.dump(post.metadata)

            # the unsafe dumper gives you nicer output, for times you want that
            dump = frontmatter.dumps(post, Dumper=pyaml.UnsafePrettyYAMLDumper)

>           self.assertEqual(dump, data)
E           AssertionError: '---\ndestination:\n  encoding:\n    xz:\[460 chars]der.' != "---\ndestination:\n  encoding:\n    xz:\[464 chars]der."
E             ---
E             destination:
E               encoding:
E                 xz:
E                   enabled: true
E                   min_size: 5120
E                   options:
E                   path_filter:
E               result:
E                 append_to_file:
E                 append_to_lafs_dir:
E                 print_to_stdout: true
E               url: http://localhost:3456/uri
E             filter:
E           -   - Длинный стринг на русском
E           +   - 'Длинный стринг на русском'
E           ?     +                         +
E           -   - Еще одна длинная строка
E           +   - 'Еще одна длинная строка'
E           ?     +                       +
E             ---
E
E             This is a test of both unicode and prettier dumping. The above metadata comes from the [pretty-yaml](https://github.com/mk-fg/pretty-yaml) readme file.
E
E             Metadata should be dumped in order.

tests/unit_test.py:130: AssertionError
========================================================================== short test summary info ===========================================================================
FAILED tests/unit_test.py::FrontmatterTest::test_pretty_dumping - AssertionError: '---\ndestination:\n  encoding:\n    xz:\[460 chars]der.' != "---\ndestination:\n  encoding:\n    xz:\[464 chars]der."
================================================================== 1 failed, 55 passed, 3 skipped in 0.18s ===================================================================