summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2009-05-10 08:15:24 +0000
committerMartin v. Löwis <martin@v.loewis.de>2009-05-10 08:15:24 +0000
commit43c57785d3319249c03c3fa46c9df42a8ccd3e52 (patch)
tree199d57826897ac525b4057253a82aaaefcb6ef82 /Lib
parente0a2b72e61a474dceb948be57cb2983f70ab07fb (diff)
downloadcpython-git-43c57785d3319249c03c3fa46c9df42a8ccd3e52.tar.gz
Rename utf8b error handler to surrogateescape.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_codecs.py20
-rw-r--r--Lib/test/test_os.py4
2 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 9ca769910b..4ec7b5865c 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -1521,32 +1521,32 @@ class TypesTest(unittest.TestCase):
self.assertEquals(codecs.raw_unicode_escape_decode(r"\u1234"), ("\u1234", 6))
self.assertEquals(codecs.raw_unicode_escape_decode(br"\u1234"), ("\u1234", 6))
-class Utf8bTest(unittest.TestCase):
+class SurrogateEscapeTest(unittest.TestCase):
def test_utf8(self):
# Bad byte
- self.assertEqual(b"foo\x80bar".decode("utf-8", "utf8b"),
+ self.assertEqual(b"foo\x80bar".decode("utf-8", "surrogateescape"),
"foo\udc80bar")
- self.assertEqual("foo\udc80bar".encode("utf-8", "utf8b"),
+ self.assertEqual("foo\udc80bar".encode("utf-8", "surrogateescape"),
b"foo\x80bar")
# bad-utf-8 encoded surrogate
- self.assertEqual(b"\xed\xb0\x80".decode("utf-8", "utf8b"),
+ self.assertEqual(b"\xed\xb0\x80".decode("utf-8", "surrogateescape"),
"\udced\udcb0\udc80")
- self.assertEqual("\udced\udcb0\udc80".encode("utf-8", "utf8b"),
+ self.assertEqual("\udced\udcb0\udc80".encode("utf-8", "surrogateescape"),
b"\xed\xb0\x80")
def test_ascii(self):
# bad byte
- self.assertEqual(b"foo\x80bar".decode("ascii", "utf8b"),
+ self.assertEqual(b"foo\x80bar".decode("ascii", "surrogateescape"),
"foo\udc80bar")
- self.assertEqual("foo\udc80bar".encode("ascii", "utf8b"),
+ self.assertEqual("foo\udc80bar".encode("ascii", "surrogateescape"),
b"foo\x80bar")
def test_charmap(self):
# bad byte: \xa5 is unmapped in iso-8859-3
- self.assertEqual(b"foo\xa5bar".decode("iso-8859-3", "utf8b"),
+ self.assertEqual(b"foo\xa5bar".decode("iso-8859-3", "surrogateescape"),
"foo\udca5bar")
- self.assertEqual("foo\udca5bar".encode("iso-8859-3", "utf8b"),
+ self.assertEqual("foo\udca5bar".encode("iso-8859-3", "surrogateescape"),
b"foo\xa5bar")
@@ -1576,7 +1576,7 @@ def test_main():
CharmapTest,
WithStmtTest,
TypesTest,
- Utf8bTest,
+ SurrogateEscapeTest,
)
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 014d874f4d..c680d8d77a 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -708,13 +708,13 @@ if sys.platform != 'win32':
self.fsencoding = sys.getfilesystemencoding()
sys.setfilesystemencoding("utf-8")
self.dir = support.TESTFN
- self.bdir = self.dir.encode("utf-8", "utf8b")
+ self.bdir = self.dir.encode("utf-8", "surrogateescape")
os.mkdir(self.dir)
self.unicodefn = []
for fn in self.filenames:
f = open(os.path.join(self.bdir, fn), "w")
f.close()
- self.unicodefn.append(fn.decode("utf-8", "utf8b"))
+ self.unicodefn.append(fn.decode("utf-8", "surrogateescape"))
def tearDown(self):
shutil.rmtree(self.dir)