summaryrefslogtreecommitdiffstats
path: root/Lib/ctypes/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-07-12 09:25:21 (GMT)
committerGuido van Rossum <guido@python.org>2007-07-12 09:25:21 (GMT)
commite409b979509af36bbd9ee8ebbc85d805062e2e95 (patch)
treeb644fc666119d5b68112ac172bf63a6bae113a39 /Lib/ctypes/test
parentfc0ffb7243b54a04ffa63789f2dfe385ffdd856c (diff)
downloadcpython-e409b979509af36bbd9ee8ebbc85d805062e2e95.zip
cpython-e409b979509af36bbd9ee8ebbc85d805062e2e95.tar.gz
cpython-e409b979509af36bbd9ee8ebbc85d805062e2e95.tar.bz2
Make this a pure-ASCII file. This used to have a Latin-1 coding and
contain several string literals using non-ASCII characters. Because of the pain of displaying those characters, it's better to use \xXX escapes for these instead of typing the accented characters. Apologies if I missed something; it didn't look like there was anything that depended on this file being encoded in Latin-1 or containing non-ASCII characters.
Diffstat (limited to 'Lib/ctypes/test')
-rw-r--r--Lib/ctypes/test/test_unicode.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/Lib/ctypes/test/test_unicode.py b/Lib/ctypes/test/test_unicode.py
index f8e6f09..3a89d8d 100644
--- a/Lib/ctypes/test/test_unicode.py
+++ b/Lib/ctypes/test/test_unicode.py
@@ -1,4 +1,3 @@
-# coding: latin-1
import unittest
import ctypes
@@ -27,14 +26,14 @@ else:
self.failUnlessEqual(wcslen("ab\u2070"), 3)
# string args are converted
self.failUnlessEqual(wcslen("abc"), 3)
- self.failUnlessRaises(ctypes.ArgumentError, wcslen, "abä")
+ self.failUnlessRaises(ctypes.ArgumentError, wcslen, "ab\xe4")
def test_ascii_replace(self):
ctypes.set_conversion_mode("ascii", "replace")
self.failUnlessEqual(wcslen("abc"), 3)
self.failUnlessEqual(wcslen("ab\u2070"), 3)
self.failUnlessEqual(wcslen("abc"), 3)
- self.failUnlessEqual(wcslen("abä"), 3)
+ self.failUnlessEqual(wcslen("ab\xe4"), 3)
def test_ascii_ignore(self):
ctypes.set_conversion_mode("ascii", "ignore")
@@ -42,14 +41,14 @@ else:
self.failUnlessEqual(wcslen("ab\u2070"), 3)
# ignore error mode skips non-ascii characters
self.failUnlessEqual(wcslen("abc"), 3)
- self.failUnlessEqual(wcslen("äöüß"), 0)
+ self.failUnlessEqual(wcslen("\xe4\xf6\xfc\xdf"), 0)
def test_latin1_strict(self):
ctypes.set_conversion_mode("latin-1", "strict")
self.failUnlessEqual(wcslen("abc"), 3)
self.failUnlessEqual(wcslen("ab\u2070"), 3)
self.failUnlessEqual(wcslen("abc"), 3)
- self.failUnlessEqual(wcslen("äöüß"), 4)
+ self.failUnlessEqual(wcslen("\xe4\xf6\xfc\xdf"), 4)
def test_buffers(self):
ctypes.set_conversion_mode("ascii", "strict")
@@ -57,11 +56,11 @@ else:
self.failUnlessEqual(len(buf), 3+1)
ctypes.set_conversion_mode("ascii", "replace")
- buf = ctypes.create_unicode_buffer("abäöü")
+ buf = ctypes.create_unicode_buffer("ab\xe4\xf6\xfc")
self.failUnlessEqual(buf[:], "ab\uFFFD\uFFFD\uFFFD\0")
ctypes.set_conversion_mode("ascii", "ignore")
- buf = ctypes.create_unicode_buffer("abäöü")
+ buf = ctypes.create_unicode_buffer("ab\xe4\xf6\xfc")
# is that correct? not sure. But with 'ignore', you get what you pay for..
self.failUnlessEqual(buf[:], "ab\0\0\0\0")
@@ -83,19 +82,19 @@ else:
ctypes.set_conversion_mode("ascii", "strict")
self.failUnlessEqual(func("abc"), "abc")
self.failUnlessEqual(func("abc"), "abc")
- self.assertRaises(ctypes.ArgumentError, func, "abä")
+ self.assertRaises(ctypes.ArgumentError, func, "ab\xe4")
def test_ascii_ignore(self):
ctypes.set_conversion_mode("ascii", "ignore")
self.failUnlessEqual(func("abc"), "abc")
self.failUnlessEqual(func("abc"), "abc")
- self.failUnlessEqual(func("äöüß"), "")
+ self.failUnlessEqual(func("\xe4\xf6\xfc\xdf"), "")
def test_ascii_replace(self):
ctypes.set_conversion_mode("ascii", "replace")
self.failUnlessEqual(func("abc"), "abc")
self.failUnlessEqual(func("abc"), "abc")
- self.failUnlessEqual(func("äöüß"), "????")
+ self.failUnlessEqual(func("\xe4\xf6\xfc\xdf"), "????")
def test_buffers(self):
ctypes.set_conversion_mode("ascii", "strict")
@@ -103,11 +102,11 @@ else:
self.failUnlessEqual(len(buf), 3+1)
ctypes.set_conversion_mode("ascii", "replace")
- buf = ctypes.create_string_buffer("abäöü")
+ buf = ctypes.create_string_buffer("ab\xe4\xf6\xfc")
self.failUnlessEqual(buf[:], "ab???\0")
ctypes.set_conversion_mode("ascii", "ignore")
- buf = ctypes.create_string_buffer("abäöü")
+ buf = ctypes.create_string_buffer("ab\xe4\xf6\xfc")
# is that correct? not sure. But with 'ignore', you get what you pay for..
self.failUnlessEqual(buf[:], "ab\0\0\0\0")