regebro / hovercraft

Make dynamic impressive presentations from text files!
https://hovercraft.readthedocs.org
MIT License
1.49k stars 208 forks source link

Test failure with lxml 4.4.1 #199

Closed panlinux closed 5 years ago

panlinux commented 5 years ago

Hi there,

with lxml 4.4.1, I'm getting test failures in hovercraft. It looks like an ordering issue:

________________________ SlideMakerTests.test_advanced _________________________

self = <tests.test_parse.SlideMakerTests testMethod=test_advanced>

    def test_advanced(self):
        tree = SlideMaker(make_tree('test_data/advanced.rst')).walk()
        xml = etree.tostring(tree)
        target = (
            b'<document source="&lt;string&gt;" title="Presentation title" '
            b'data-transition-duration="2000" auto-console="True" '
            b'css-screen="extra.css" js-body="extra.js"><paragraph>This is an advanced '
            b'presentation. It doesn\'t have a section in the first\nstep, '
            b'meaning the first step will not be a step at all, but a sort of\n'
            b'introductory comment about the presentation, that will not show up '
            b'in the\npresentation at all.</paragraph><paragraph>It also sets a '
            b'title and a transition-duration.</paragraph><step class="step '
            b'step-level-1" step="0" data-x="1000" data-y="1600"><section '
            b'ids="advanced-presentation" names="advanced\\ presentation">'
            b'<title>Advanced Presentation</title><paragraph>Here we '
            b'show the positioning feature, where we can explicitly set a '
            b'position\non one of the steps.</paragraph></section></step><step '
            b'class="step step-level-1" step="1" id="name-this-step" '
            b'data-x="r1600"><section ids="formatting" names="formatting"><title>'
            b'Formatting</title><paragraph>Let us also try some basic '
            b'formatting, like <emphasis>italic</emphasis>, and <strong>bold'
            b'</strong>.</paragraph><bullet_list bullet="*"><list_item>'
            b'<paragraph>We can also</paragraph></list_item><list_item>'
            b'<paragraph>have a list</paragraph></list_item><list_item>'
            b'<paragraph>of things.</paragraph></list_item></bullet_list>'
            b'</section></step><step class="step step-level-1" step="2">'
            b'<paragraph>There should also be possible to have\n'
            b'preformatted text for code.</paragraph><literal_block '
            b'classes="code python" xml:space="preserve"><inline classes="k">'
            b'def</inline> <inline classes="nf">foo</inline><inline '
            b'classes="p">(</inline><inline classes="n">bar</inline><inline '
            b'classes="p">):</inline>\n    <inline classes="c1"># Comment'
            b'</inline>\n    <inline classes="n">a</inline> <inline '
            b'classes="o">=</inline> <inline classes="mi">1</inline> <inline '
            b'classes="o">+</inline> <inline classes="s2">"hubbub"</inline>'
            b'\n    <inline classes="k">return</inline> <inline classes="bp">'
            b'None</inline></literal_block></step><step class="step step-level-1"'
            b' step="3"><paragraph>An image, with attributes:</paragraph><image '
            b'classes="imageclass" uri="images/hovercraft_logo.png" width="50%"/>'
            b'</step><step class="step step-level-1" step="4"><section ids="character-sets" '
            b'names="character\\ sets"><title>Character sets</title><paragraph>'
            b'The character set is UTF-8 as of now. Like this: '
            b'&#229;&#228;&#246;.</paragraph></section></step></document>')
>       self.assertEqual(xml, target)
E       AssertionError: b'<do[487 chars]step step="0" class="step step-level-1" data-x[1829 chars]ent>' != b'<do[487 chars]step class="step step-level-1" step="0" data-x[1829 chars]ent>'

With lxml 4.3.3 the tests pass.

regebro commented 5 years ago

Yeah, I think it's an ordering issue. It works with the lxml 4.4.1 now and is likely to not work with older versions. The way the tests work means they are sensitive to these things, but rewriting them so they are not would be a lot of work.