changeset 25051:9c28f3236677

run-tests: do cdata escaping using bytes instead of str
author Augie Fackler <augie@google.com>
date Tue, 14 Apr 2015 16:18:11 -0400
parents 28526bb5b3b5
children c4217a046b62
files tests/run-tests.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Mon Apr 13 16:33:12 2015 -0400
+++ b/tests/run-tests.py	Tue Apr 14 16:18:11 2015 -0400
@@ -354,7 +354,7 @@
 
 # Bytes that break XML even in a CDATA block: control characters 0-31
 # sans \t, \n and \r
-CDATA_EVIL = re.compile(r"[\000-\010\013\014\016-\037]")
+CDATA_EVIL = re.compile(br"[\000-\010\013\014\016-\037]")
 
 def cdatasafe(data):
     """Make a string safe to include in a CDATA block.
@@ -364,7 +364,7 @@
     replaces illegal bytes with ? and adds a space between the ]] so
     that it won't break the CDATA block.
     """
-    return CDATA_EVIL.sub('?', data).replace(']]>', '] ]>')
+    return CDATA_EVIL.sub(b'?', data).replace(b']]>', b'] ]>')
 
 def log(*msg):
     """Log something to stdout.