ITADN

Most of `test_svg.py` fails with Python 3.13, apparently over indentation differences

#199Closedmgorny 创建于 2024-06-14
M
mgornycommented
```pytb $ python3.13 -m pytest -vv ========================================================= test session starts ========================================================= platform linux -- Python 3.13.0b2, pytest-8.2.2, pluggy-1.5.0 -- /usr/bin/python3.13 cachedir: .pytest_cache rootdir: /tmp/dominate configfile: pyproject.toml collected 65 items tests/test_document.py::test_doc PASSED [ 1%] tests/test_document.py::test_decorator PASSED [ 3%] tests/test_document.py::test_bare_decorator PASSED [ 4%] tests/test_document.py::test_title PASSED [ 6%] tests/test_document.py::test_containers PASSED [ 7%] tests/test_document.py::test_attributes PASSED [ 9%] tests/test_document.py::test_repr PASSED [ 10%] tests/test_dom1core.py::test_dom PASSED [ 12%] tests/test_dom1core.py::test_element PASSED [ 13%] tests/test_dom1core.py::test_parent_node PASSED [ 15%] tests/test_dom_tag.py::test___get_thread_context PASSED [ 16%] tests/test_dom_tag.py::test_add_raw_string PASSED [ 18%] tests/test_dom_tag.py::test_clear PASSED [ 20%] tests/test_dom_tag.py::test_set_attribute PASSED [ 21%] tests/test_dom_tag.py::test_set_attribute_error PASSED [ 23%] tests/test_dom_tag.py::test___get_item___child_index_error PASSED [ 24%] tests/test_dom_tag.py::test___contains__ PASSED [ 26%] tests/test_dom_tag.py::test_nested_context PASSED [ 27%] tests/test_dom_tag_async.py::test_async_bleed PASSED [ 29%] tests/test_dominate.py::test_version PASSED [ 30%] tests/test_html.py::test_arguments PASSED [ 32%] tests/test_html.py::test_kwargs PASSED [ 33%] tests/test_html.py::test_repr PASSED [ 35%] tests/test_html.py::test_add PASSED [ 36%] tests/test_html.py::test_iadd PASSED [ 38%] tests/test_html.py::test_context_manager PASSED [ 40%] tests/test_html.py::test_decorator PASSED [ 41%] tests/test_html.py::test_nested_decorator PASSED [ 43%] tests/test_html.py::test_text PASSED [ 44%] tests/test_html.py::test_raw PASSED [ 46%] tests/test_html.py::test_escape PASSED [ 47%] tests/test_html.py::test_get_context PASSED [ 49%] tests/test_html.py::test_attributes PASSED [ 50%] tests/test_html.py::test_attribute_none PASSED [ 52%] tests/test_html.py::test_attribute_dashes PASSED [ 53%] tests/test_html.py::test_lazy PASSED [ 55%] tests/test_html.py::test_keyword_attributes PASSED [ 56%] tests/test_html.py::test_namespaced_attributes PASSED [ 58%] tests/test_html.py::test_comment PASSED [ 60%] tests/test_html.py::test_boolean_attributes PASSED [ 61%] tests/test_html.py::test_nested_decorator_2 PASSED [ 63%] tests/test_html.py::test_pretty PASSED [ 64%] tests/test_html.py::test_xhtml PASSED [ 66%] tests/test_html.py::test_verbatim_attributes PASSED [ 67%] tests/test_svg.py::test_animate FAILED [ 69%] tests/test_svg.py::test_animate_motion FAILED [ 70%] tests/test_svg.py::test_animate_transform FAILED [ 72%] tests/test_svg.py::test_circle FAILED [ 73%] tests/test_svg.py::test_clip_path FAILED [ 75%] tests/test_svg.py::test_defs FAILED [ 76%] tests/test_svg.py::test_ellipse FAILED [ 78%] tests/test_svg.py::test_filters PASSED [ 80%] tests/test_svg.py::test_g FAILED [ 81%] tests/test_svg.py::test_line FAILED [ 83%] tests/test_svg.py::test_linear_gradient FAILED [ 84%] tests/test_svg.py::test_marker FAILED [ 86%] tests/test_svg.py::test_mask FAILED [ 87%] tests/test_svg.py::test_pattern FAILED [ 89%] tests/test_svg.py::test_radial_gradient FAILED [ 90%] tests/test_utils.py::test_context PASSED [ 92%] tests/test_utils.py::test_include PASSED [ 93%] tests/test_utils.py::test_system PASSED [ 95%] tests/test_utils.py::test_unescape PASSED [ 96%] tests/test_utils.py::test_url PASSED [ 98%] tests/test_utils.py::test_container PASSED [100%] ============================================================== FAILURES =============================================================== ____________________________________________________________ test_animate _____________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <rect height="100" width="100" x="10" y="10">\n <animate attributeName="x" attributeType="XML" dur="10s" from="-100" repeatCount="indefinite" to="120"></animate>\n </rect>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<rect height="100" width="100" x="10" y="10">\n <animate attributeName="x" attributeType="XML" dur="10s" from="-100" repeatCount="indefinite" to="120"></animate>\n</rect>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <rect height="100" width="100" x="10" y="10"> E + <rect height="100" width="100" x="10" y="10"> E ? ++ E - <animate attributeName="x" attributeType="XML" dur="10s" from="-100" repeatCount="indefinite" to="120"></animate> E + <animate attributeName="x" attributeType="XML" dur="10s" from="-100" repeatCount="indefinite" to="120"></animate> E ? ++ E - </rect> E + </rect> E ? ++ E </svg> tests/test_svg.py:24: AssertionError _________________________________________________________ test_animate_motion _________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <path d="M10,110 A120,120 -45 0,1 110 10 A120,120 -45 0,1 10,110" fill="none" id="theMotionPath" stroke="lightgrey" stroke-width="2"></path>\n <circle cx="10" cy="110" fill="lightgrey" r="3"></circle>\n <circle cx="110" cy="10" fill="lightgrey" r="3"></circle>\n <circle cx="" cy="" fill="red" r="5">\n <animateMotion dur="6s" repeatCount="indefinite">\n <mpath xlink:href="#theMotionPath"></mpath>\n </animateMotion>\n </circle>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<path d="M10,110 A120,120 -45 0,1 110 10 A120,120 -45 0,1 10,110" fill="none" id="theMotionPath" stroke="lightgrey" stroke-width="2"></path>\n<circle cx="10" cy="110" fill="lightgrey" r="3"></circle>\n<circle cx="110" cy="10" fill="lightgrey" r="3"></circle>\n<circle cx="" cy="" fill="red" r="5">\n <animateMotion dur="6s" repeatCount="indefinite">\n <mpath xlink:href="#theMotionPath"></mpath>\n </animateMotion>\n</circle>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <path d="M10,110 A120,120 -45 0,1 110 10 A120,120 -45 0,1 10,110" fill="none" id="theMotionPath" stroke="lightgrey" stroke-width="2"></path> E + <path d="M10,110 A120,120 -45 0,1 110 10 A120,120 -45 0,1 10,110" fill="none" id="theMotionPath" stroke="lightgrey" stroke-width="2"></path> E ? ++ E - <circle cx="10" cy="110" fill="lightgrey" r="3"></circle> E + <circle cx="10" cy="110" fill="lightgrey" r="3"></circle> E ? ++ E - <circle cx="110" cy="10" fill="lightgrey" r="3"></circle> E + <circle cx="110" cy="10" fill="lightgrey" r="3"></circle> E ? ++ E - <circle cx="" cy="" fill="red" r="5"> E + <circle cx="" cy="" fill="red" r="5"> E ? ++ E - <animateMotion dur="6s" repeatCount="indefinite"> E + <animateMotion dur="6s" repeatCount="indefinite"> E ? ++ E - <mpath xlink:href="#theMotionPath"></mpath> E + <mpath xlink:href="#theMotionPath"></mpath> E ? ++ E - </animateMotion> E + </animateMotion> E ? ++ E - </circle> E + </circle> E ? ++ E </svg> tests/test_svg.py:24: AssertionError _______________________________________________________ test_animate_transform ________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <polygon points="60,30 90,90, 30,90">\n <animateTransform attributeName="transform" attributeType="XML" dur="10s" from="0 60 70" repeatCount="indefinite" to="360 60 70" type="rotate">\n </polygon>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<polygon points="60,30 90,90, 30,90">\n <animateTransform attributeName="transform" attributeType="XML" dur="10s" from="0 60 70" repeatCount="indefinite" to="360 60 70" type="rotate">\n</polygon>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <polygon points="60,30 90,90, 30,90"> E + <polygon points="60,30 90,90, 30,90"> E ? ++ E - <animateTransform attributeName="transform" attributeType="XML" dur="10s" from="0 60 70" repeatCount="indefinite" to="360 60 70" type="rotate"> E + <animateTransform attributeName="transform" attributeType="XML" dur="10s" from="0 60 70" repeatCount="indefinite" to="360 60 70" type="rotate"> E ? ++ E - </polygon> E + </polygon> E ? ++ E </svg> tests/test_svg.py:24: AssertionError _____________________________________________________________ test_circle _____________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <circle cx="50" cy="60" fill="black" r="30">\n <desc>I am a circle</desc>\n </circle>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<circle cx="50" cy="60" fill="black" r="30">\n <desc>I am a circle</desc>\n</circle>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <circle cx="50" cy="60" fill="black" r="30"> E + <circle cx="50" cy="60" fill="black" r="30"> E ? ++ E - <desc>I am a circle</desc> E + <desc>I am a circle</desc> E ? ++ E - </circle> E + </circle> E ? ++ E </svg> tests/test_svg.py:24: AssertionError ___________________________________________________________ test_clip_path ____________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <clipPath id="MyClip">\n <circle cx="20" cy="30" r="40"></circle>\n </clipPath>\n <path d="M10,30 A20,20,0,0,1,50,30 A20,20,0,0,1,90,30 Q90,60,50,90 Q10,60,10,30 Z" id="heart"></path>\n <use clip-path="url(#MyClip)" fill="red" xlink:href="#heart"></use>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<clipPath id="MyClip">\n <circle cx="20" cy="30" r="40"></circle>\n</clipPath>\n<path d="M10,30 A20,20,0,0,1,50,30 A20,20,0,0,1,90,30 Q90,60,50,90 Q10,60,10,30 Z" id="heart"></path>\n<use clip-path="url(#MyClip)" fill="red" xlink:href="#heart"></use>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <clipPath id="MyClip"> E + <clipPath id="MyClip"> E ? ++ E - <circle cx="20" cy="30" r="40"></circle> E + <circle cx="20" cy="30" r="40"></circle> E ? ++ E - </clipPath> E + </clipPath> E ? ++ E - <path d="M10,30 A20,20,0,0,1,50,30 A20,20,0,0,1,90,30 Q90,60,50,90 Q10,60,10,30 Z" id="heart"></path> E + <path d="M10,30 A20,20,0,0,1,50,30 A20,20,0,0,1,90,30 Q90,60,50,90 Q10,60,10,30 Z" id="heart"></path> E ? ++ E - <use clip-path="url(#MyClip)" fill="red" xlink:href="#heart"></use> E + <use clip-path="url(#MyClip)" fill="red" xlink:href="#heart"></use> E ? ++ E </svg> tests/test_svg.py:24: AssertionError ______________________________________________________________ test_defs ______________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <defs>\n <circle cx="50" cy="60" fill="black" r="30"></circle>\n </defs>\n <use x="5" xlink:href="#myCircle" y="5"></use>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<defs>\n <circle cx="50" cy="60" fill="black" r="30"></circle>\n</defs>\n<use x="5" xlink:href="#myCircle" y="5"></use>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <defs> E + <defs> E ? ++ E - <circle cx="50" cy="60" fill="black" r="30"></circle> E + <circle cx="50" cy="60" fill="black" r="30"></circle> E ? ++ E - </defs> E + </defs> E ? ++ E - <use x="5" xlink:href="#myCircle" y="5"></use> E + <use x="5" xlink:href="#myCircle" y="5"></use> E ? ++ E </svg> tests/test_svg.py:24: AssertionError ____________________________________________________________ test_ellipse _____________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <ellipse cx="100" cy="50" rx="100" ry="50"></ellipse>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<ellipse cx="100" cy="50" rx="100" ry="50"></ellipse>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <ellipse cx="100" cy="50" rx="100" ry="50"></ellipse> E + <ellipse cx="100" cy="50" rx="100" ry="50"></ellipse> E ? ++ E </svg> tests/test_svg.py:24: AssertionError _______________________________________________________________ test_g ________________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g fill="white" stroke="green" stroke-width="5">\n <circle r="25" rx="40" ry="40"></circle>\n <circle r="25" rx="60" ry="60"></circle>\n </g>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<g fill="white" stroke="green" stroke-width="5">\n <circle r="25" rx="40" ry="40"></circle>\n <circle r="25" rx="60" ry="60"></circle>\n</g>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <g fill="white" stroke="green" stroke-width="5"> E + <g fill="white" stroke="green" stroke-width="5"> E ? ++ E - <circle r="25" rx="40" ry="40"></circle> E + <circle r="25" rx="40" ry="40"></circle> E ? ++ E - <circle r="25" rx="60" ry="60"></circle> E + <circle r="25" rx="60" ry="60"></circle> E ? ++ E - </g> E + </g> E ? ++ E </svg> tests/test_svg.py:24: AssertionError ______________________________________________________________ test_line ______________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <line stroke="red" x0="0" x1="50" y0="0" y1="50"></line>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<line stroke="red" x0="0" x1="50" y0="0" y1="50"></line>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <line stroke="red" x0="0" x1="50" y0="0" y1="50"></line> E + <line stroke="red" x0="0" x1="50" y0="0" y1="50"></line> E ? ++ E </svg> tests/test_svg.py:24: AssertionError ________________________________________________________ test_linear_gradient _________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <defs>\n <linearGradient gradientTransform="rotate(90)" id="myGradient">\n <stop offset="5%" stop-color="gold"></stop>\n <stop offset="95%" stop-color="red"></stop>\n </linearGradient>\n </defs>\n <circle fill="url(\'#myGradient\')" r="40" rx="50" ry="50"></circle>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<defs>\n <linearGradient gradientTransform="rotate(90)" id="myGradient">\n <stop offset="5%" stop-color="gold"></stop>\n <stop offset="95%" stop-color="red"></stop>\n </linearGradient>\n</defs>\n<circle fill="url(\'#myGradient\')" r="40" rx="50" ry="50"></circle>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <defs> E + <defs> E ? ++ E - <linearGradient gradientTransform="rotate(90)" id="myGradient"> E + <linearGradient gradientTransform="rotate(90)" id="myGradient"> E ? ++ E - <stop offset="5%" stop-color="gold"></stop> E + <stop offset="5%" stop-color="gold"></stop> E ? ++ E - <stop offset="95%" stop-color="red"></stop> E + <stop offset="95%" stop-color="red"></stop> E ? ++ E - </linearGradient> E + </linearGradient> E ? ++ E - </defs> E + </defs> E ? ++ E - <circle fill="url('#myGradient')" r="40" rx="50" ry="50"></circle> E + <circle fill="url('#myGradient')" r="40" rx="50" ry="50"></circle> E ? ++ E </svg> tests/test_svg.py:24: AssertionError _____________________________________________________________ test_marker _____________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <defs>\n <marker id="arrow" markerHeight="6" markerWidth="6" orient="auto-start-reverse" refX="5" refY="5" viewBox="0 0 10 10">\n <path d="M 0 0 L 10 5 L 0 10 z"></path>\n </marker>\n </defs>\n <polyline fill="none" marker-end="url(#arrow)" marker-start="url(#arrow)" points="10,10 10,90 90,90" stroke="black"></polyline>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<defs>\n <marker id="arrow" markerHeight="6" markerWidth="6" orient="auto-start-reverse" refX="5" refY="5" viewBox="0 0 10 10">\n <path d="M 0 0 L 10 5 L 0 10 z"></path>\n </marker>\n</defs>\n<polyline fill="none" marker-end="url(#arrow)" marker-start="url(#arrow)" points="10,10 10,90 90,90" stroke="black"></polyline>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <defs> E + <defs> E ? ++ E - <marker id="arrow" markerHeight="6" markerWidth="6" orient="auto-start-reverse" refX="5" refY="5" viewBox="0 0 10 10"> E + <marker id="arrow" markerHeight="6" markerWidth="6" orient="auto-start-reverse" refX="5" refY="5" viewBox="0 0 10 10"> E ? ++ E - <path d="M 0 0 L 10 5 L 0 10 z"></path> E + <path d="M 0 0 L 10 5 L 0 10 z"></path> E ? ++ E - </marker> E + </marker> E ? ++ E - </defs> E + </defs> E ? ++ E - <polyline fill="none" marker-end="url(#arrow)" marker-start="url(#arrow)" points="10,10 10,90 90,90" stroke="black"></polyline> E + <polyline fill="none" marker-end="url(#arrow)" marker-start="url(#arrow)" points="10,10 10,90 90,90" stroke="black"></polyline> E ? ++ E </svg> tests/test_svg.py:24: AssertionError ______________________________________________________________ test_mask ______________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <mask id="myMask">\n <rect fill="white" height="100" width="100" x="0" y="0"></rect>\n <path d="M10,35 A20,20,0,0,1,50,35 A20,20,0,0,1,90,35 Q90,65,50,95 Q10,65,10,35 Z" fill="black"></path>\n </mask>\n <polygon fill="orange" points="-10,110 110,110 110,-10"></polygon>\n <circle cx="50" cy="50" mask="url(#myMask)" r="50"></circle>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<mask id="myMask">\n <rect fill="white" height="100" width="100" x="0" y="0"></rect>\n <path d="M10,35 A20,20,0,0,1,50,35 A20,20,0,0,1,90,35 Q90,65,50,95 Q10,65,10,35 Z" fill="black"></path>\n</mask>\n<polygon fill="orange" points="-10,110 110,110 110,-10"></polygon>\n<circle cx="50" cy="50" mask="url(#myMask)" r="50"></circle>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <mask id="myMask"> E + <mask id="myMask"> E ? ++ E - <rect fill="white" height="100" width="100" x="0" y="0"></rect> E + <rect fill="white" height="100" width="100" x="0" y="0"></rect> E ? ++ E - <path d="M10,35 A20,20,0,0,1,50,35 A20,20,0,0,1,90,35 Q90,65,50,95 Q10,65,10,35 Z" fill="black"></path> E + <path d="M10,35 A20,20,0,0,1,50,35 A20,20,0,0,1,90,35 Q90,65,50,95 Q10,65,10,35 Z" fill="black"></path> E ? ++ E - </mask> E + </mask> E ? ++ E - <polygon fill="orange" points="-10,110 110,110 110,-10"></polygon> E + <polygon fill="orange" points="-10,110 110,110 110,-10"></polygon> E ? ++ E - <circle cx="50" cy="50" mask="url(#myMask)" r="50"></circle> E + <circle cx="50" cy="50" mask="url(#myMask)" r="50"></circle> E ? ++ E </svg> tests/test_svg.py:24: AssertionError ____________________________________________________________ test_pattern _____________________________________________________________ def test_pattern(): ''' <svg viewBox="0 0 230 100"> <defs> <pattern height="10%" id="star" viewBox="0 0 10 10" width="10%"> <polygon points="0,0 2,5 0,10 5,8 10,10 8,5 10,0 5,2"></polygon> </pattern> </defs> <circle cx="50" cy="50" fill="url(#star)" r="50"></circle> <circle cx="180" cy="50" fill="none" r="50" stroke="url(#star)" stroke-width="20"></circle> </svg> ''' with svg(viewBox="0 0 230 100") as result: with defs(): with pattern(id="star", viewBox="0 0 10 10", width="10%", height="10%"): polygon(points="0,0 2,5 0,10 5,8 10,10 8,5 10,0 5,2") circle(cx=50, cy=50, r=50, fill="url(#star)") circle(cx=180, cy=50, r=50, fill="none", stroke_width=20, stroke="url(#star)") > assert result.render() == get_expected(test_pattern) E assert '<svg viewBox="0 0 230 100">\n <defs>\n <pattern height="10%" id="star" viewBox="0 0 10 10" width="10%">\n <polygon points="0,0 2,5 0,10 5,8 10,10 8,5 10,0 5,2"></polygon>\n </pattern>\n </defs>\n <circle cx="50" cy="50" fill="url(#star)" r="50"></circle>\n <circle cx="180" cy="50" fill="none" r="50" stroke="url(#star)" stroke-width="20"></circle>\n</svg>' == '<svg viewBox="0 0 230 100">\n<defs>\n <pattern height="10%" id="star" viewBox="0 0 10 10" width="10%">\n <polygon points="0,0 2,5 0,10 5,8 10,10 8,5 10,0 5,2"></polygon>\n </pattern>\n</defs>\n<circle cx="50" cy="50" fill="url(#star)" r="50"></circle>\n<circle cx="180" cy="50" fill="none" r="50" stroke="url(#star)" stroke-width="20"></circle>\n</svg>' E E <svg viewBox="0 0 230 100"> E - <defs> E + <defs> E ? ++ E - <pattern height="10%" id="star" viewBox="0 0 10 10" width="10%"> E + <pattern height="10%" id="star" viewBox="0 0 10 10" width="10%"> E ? ++ E - <polygon points="0,0 2,5 0,10 5,8 10,10 8,5 10,0 5,2"></polygon> E + <polygon points="0,0 2,5 0,10 5,8 10,10 8,5 10,0 5,2"></polygon> E ? ++ E - </pattern> E + </pattern> E ? ++ E - </defs> E + </defs> E ? ++ E - <circle cx="50" cy="50" fill="url(#star)" r="50"></circle> E + <circle cx="50" cy="50" fill="url(#star)" r="50"></circle> E ? ++ E - <circle cx="180" cy="50" fill="none" r="50" stroke="url(#star)" stroke-width="20"></circle> E + <circle cx="180" cy="50" fill="none" r="50" stroke="url(#star)" stroke-width="20"></circle> E ? ++ E </svg> tests/test_svg.py:251: AssertionError ________________________________________________________ test_radial_gradient _________________________________________________________ def wrapper(): with base() as result: func() > assert result.render() == get_expected(func) E assert '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <defs>\n <radialGradient id="myGradient">\n <stop offset="10%" stop-color="gold"></stop>\n <stop offset="95%" stop-color="red"></stop>\n </radialGradient>\n </defs>\n <circle cx="50" cy="5" fill="url(#myGradient)" r="50"></circle>\n</svg>' == '<svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<defs>\n <radialGradient id="myGradient">\n <stop offset="10%" stop-color="gold"></stop>\n <stop offset="95%" stop-color="red"></stop>\n </radialGradient>\n</defs>\n<circle cx="50" cy="5" fill="url(#myGradient)" r="50"></circle>\n</svg>' E E <svg height="120" version="1.1" viewBox="0 0 120 120" width="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> E - <defs> E + <defs> E ? ++ E - <radialGradient id="myGradient"> E + <radialGradient id="myGradient"> E ? ++ E - <stop offset="10%" stop-color="gold"></stop> E + <stop offset="10%" stop-color="gold"></stop> E ? ++ E - <stop offset="95%" stop-color="red"></stop> E + <stop offset="95%" stop-color="red"></stop> E ? ++ E - </radialGradient> E + </radialGradient> E ? ++ E - </defs> E + </defs> E ? ++ E - <circle cx="50" cy="5" fill="url(#myGradient)" r="50"></circle> E + <circle cx="50" cy="5" fill="url(#myGradient)" r="50"></circle> E ? ++ E </svg> tests/test_svg.py:24: AssertionError ========================================================== warnings summary =========================================================== tests/test_document.py::test_doc /tmp/dominate/dominate/dom_tag.py:74: DeprecationWarning: There is no current event loop if get_event_loop().is_running(): -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ```
关闭于 2024-11-26 0 条评论