Skip to content

Commit

Permalink
Fix a test in Py2.
Browse files Browse the repository at this point in the history
  • Loading branch information
scoder committed Dec 12, 2021
1 parent a3eacbc commit a9611ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lxml/html/tests/test_clean.py
@@ -1,5 +1,6 @@
import base64
import gzip
import io
import unittest
from lxml.tests.common_imports import make_doctest

Expand Down Expand Up @@ -188,7 +189,11 @@ def test_sneaky_urls_in_style(self):
def test_svg_data_links(self):
# Remove SVG images with potentially insecure content.
svg = b'<svg onload="alert(123)" />'
svgz = gzip.compress(svg)
gzout = io.BytesIO()
f = gzip.GzipFile(fileobj=gzout, mode='wb')
f.write(svg)
f.close()
svgz = gzout.getvalue()
svg_b64 = base64.b64encode(svg).decode('ASCII')
svgz_b64 = base64.b64encode(svgz).decode('ASCII')
urls = [
Expand Down

0 comments on commit a9611ba

Please sign in to comment.