diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2021-12-12 15:23:49 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2021-12-12 15:23:49 +0100 |
commit | a9611ba80bc5196c1dd07a0b1964fcb603695d63 (patch) | |
tree | fbdafa9fcf03d0d78bb7ab9682c315599933e398 /src | |
parent | a3eacbc0dcf1de1c822ec29fb7d090a4b1712a9c (diff) | |
download | python-lxml-lxml-4.6.tar.gz |
Fix a test in Py2.lxml-4.6.5lxml-4.6
Diffstat (limited to 'src')
-rw-r--r-- | src/lxml/html/tests/test_clean.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lxml/html/tests/test_clean.py b/src/lxml/html/tests/test_clean.py index aec87cd9..2c785f56 100644 --- a/src/lxml/html/tests/test_clean.py +++ b/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 @@ -188,7 +189,11 @@ class CleanerTest(unittest.TestCase): 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 = [ |