summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 3b1f7c6..1ede133 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -83,6 +83,34 @@ class ReTests(unittest.TestCase):
self.assertEqual(re.sub('\r\n', '\n', 'abc\r\ndef\r\n'),
'abc\ndef\n')
+# This test makes no sense until re supports bytes, and should then probably
+# test for the *in*ability to mix bytes and str this way :)
+#
+# def test_bug_1140(self):
+# # re.sub(x, y, b'') should return b'', not '', and
+# # re.sub(x, y, '') should return '', not b''.
+# # Also:
+# # re.sub(x, y, str(x)) should return str(y), and
+# # re.sub(x, y, bytes(x)) should return
+# # str(y) if isinstance(y, str) else unicode(y).
+# for x in 'x', u'x':
+# for y in 'y', u'y':
+# z = re.sub(x, y, u'')
+# self.assertEqual(z, u'')
+# self.assertEqual(type(z), unicode)
+# #
+# z = re.sub(x, y, '')
+# self.assertEqual(z, '')
+# self.assertEqual(type(z), str)
+# #
+# z = re.sub(x, y, unicode(x))
+# self.assertEqual(z, y)
+# self.assertEqual(type(z), unicode)
+# #
+# z = re.sub(x, y, str(x))
+# self.assertEqual(z, y)
+# self.assertEqual(type(z), type(y))
+
def test_sub_template_numeric_escape(self):
# bug 776311 and friends
self.assertEqual(re.sub('x', r'\0', 'x'), '\0')