mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Issue #11694: Raise ConversionError in xdrlib as documented
This commit is contained in:
parent
866c4e2188
commit
3894b2a24f
3 changed files with 52 additions and 8 deletions
|
|
@ -51,8 +51,32 @@ class XDRTest(unittest.TestCase):
|
|||
up.done()
|
||||
self.assertRaises(EOFError, up.unpack_uint)
|
||||
|
||||
class ConversionErrorTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.packer = xdrlib.Packer()
|
||||
|
||||
def assertRaisesConversion(self, *args):
|
||||
self.assertRaises(xdrlib.ConversionError, *args)
|
||||
|
||||
def test_pack_int(self):
|
||||
self.assertRaisesConversion(self.packer.pack_int, 'string')
|
||||
|
||||
def test_pack_uint(self):
|
||||
self.assertRaisesConversion(self.packer.pack_uint, 'string')
|
||||
|
||||
def test_float(self):
|
||||
self.assertRaisesConversion(self.packer.pack_float, 'string')
|
||||
|
||||
def test_double(self):
|
||||
self.assertRaisesConversion(self.packer.pack_double, 'string')
|
||||
|
||||
def test_uhyper(self):
|
||||
self.assertRaisesConversion(self.packer.pack_uhyper, 'string')
|
||||
|
||||
def test_main():
|
||||
support.run_unittest(XDRTest)
|
||||
support.run_unittest(ConversionErrorTest)
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue