summaryrefslogtreecommitdiff
path: root/Lib/test/test_codeccallbacks.py
diff options
context:
space:
mode:
authorRichard Jones <richard@commonground.com.au>2006-05-27 12:29:24 +0000
committerRichard Jones <richard@commonground.com.au>2006-05-27 12:29:24 +0000
commit7b9558d37dc7f2c6ae984cf25d16b9bf5e532b77 (patch)
tree70f313905c1ef84f4ba281cab615c32e06820460 /Lib/test/test_codeccallbacks.py
parent1fcdc232dbfbd05b92eaed42bf9f779d27c55a92 (diff)
downloadcpython-git-7b9558d37dc7f2c6ae984cf25d16b9bf5e532b77.tar.gz
Conversion of exceptions over from faked-up classes to new-style C types.
Diffstat (limited to 'Lib/test/test_codeccallbacks.py')
-rw-r--r--Lib/test/test_codeccallbacks.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py
index c6e56c9dd7..159c86d108 100644
--- a/Lib/test/test_codeccallbacks.py
+++ b/Lib/test/test_codeccallbacks.py
@@ -18,30 +18,12 @@ class PosReturn:
self.pos = len(exc.object)
return (u"<?>", oldpos)
-# A UnicodeEncodeError object without a start attribute
-class NoStartUnicodeEncodeError(UnicodeEncodeError):
- def __init__(self):
- UnicodeEncodeError.__init__(self, "ascii", u"", 0, 1, "bad")
- del self.start
-
# A UnicodeEncodeError object with a bad start attribute
class BadStartUnicodeEncodeError(UnicodeEncodeError):
def __init__(self):
UnicodeEncodeError.__init__(self, "ascii", u"", 0, 1, "bad")
self.start = []
-# A UnicodeEncodeError object without an end attribute
-class NoEndUnicodeEncodeError(UnicodeEncodeError):
- def __init__(self):
- UnicodeEncodeError.__init__(self, "ascii", u"", 0, 1, "bad")
- del self.end
-
-# A UnicodeEncodeError object without an object attribute
-class NoObjectUnicodeEncodeError(UnicodeEncodeError):
- def __init__(self):
- UnicodeEncodeError.__init__(self, "ascii", u"", 0, 1, "bad")
- del self.object
-
# A UnicodeEncodeError object with a bad object attribute
class BadObjectUnicodeEncodeError(UnicodeEncodeError):
def __init__(self):
@@ -478,55 +460,15 @@ class CodecCallbackTest(unittest.TestCase):
UnicodeError("ouch")
)
self.assertRaises(
- AttributeError,
- codecs.replace_errors,
- NoStartUnicodeEncodeError()
- )
- self.assertRaises(
- TypeError,
- codecs.replace_errors,
- BadStartUnicodeEncodeError()
- )
- self.assertRaises(
- AttributeError,
- codecs.replace_errors,
- NoEndUnicodeEncodeError()
- )
- self.assertRaises(
- AttributeError,
- codecs.replace_errors,
- NoObjectUnicodeEncodeError()
- )
- self.assertRaises(
TypeError,
codecs.replace_errors,
BadObjectUnicodeEncodeError()
)
self.assertRaises(
- AttributeError,
- codecs.replace_errors,
- NoEndUnicodeDecodeError()
- )
- self.assertRaises(
TypeError,
codecs.replace_errors,
BadObjectUnicodeDecodeError()
)
- self.assertRaises(
- AttributeError,
- codecs.replace_errors,
- NoStartUnicodeTranslateError()
- )
- self.assertRaises(
- AttributeError,
- codecs.replace_errors,
- NoEndUnicodeTranslateError()
- )
- self.assertRaises(
- AttributeError,
- codecs.replace_errors,
- NoObjectUnicodeTranslateError()
- )
# With the correct exception, "replace" returns an "?" or u"\ufffd" replacement
self.assertEquals(
codecs.replace_errors(UnicodeEncodeError("ascii", u"\u3042", 0, 1, "ouch")),
@@ -565,21 +507,6 @@ class CodecCallbackTest(unittest.TestCase):
codecs.xmlcharrefreplace_errors,
UnicodeTranslateError(u"\u3042", 0, 1, "ouch")
)
- self.assertRaises(
- AttributeError,
- codecs.xmlcharrefreplace_errors,
- NoStartUnicodeEncodeError()
- )
- self.assertRaises(
- AttributeError,
- codecs.xmlcharrefreplace_errors,
- NoEndUnicodeEncodeError()
- )
- self.assertRaises(
- AttributeError,
- codecs.xmlcharrefreplace_errors,
- NoObjectUnicodeEncodeError()
- )
# Use the correct exception
cs = (0, 1, 9, 10, 99, 100, 999, 1000, 9999, 10000, 0x3042)
s = "".join(unichr(c) for c in cs)