]>
Commit | Line | Data |
---|---|---|
4710c53d | 1 | """\r |
2 | Test the internal getargs.c implementation\r | |
3 | \r | |
4 | PyArg_ParseTuple() is defined here.\r | |
5 | \r | |
6 | The test here is not intended to test all of the module, just the\r | |
7 | single case that failed between 2.1 and 2.2a2.\r | |
8 | """\r | |
9 | \r | |
10 | # marshal.loads() uses PyArg_ParseTuple(args, "s#:loads")\r | |
11 | # The s code will cause a Unicode conversion to occur. This test\r | |
12 | # verify that the error is propagated properly from the C code back to\r | |
13 | # Python.\r | |
14 | \r | |
15 | import marshal\r | |
16 | import unittest\r | |
17 | from test import test_support\r | |
18 | \r | |
19 | class GetArgsTest(unittest.TestCase):\r | |
20 | # If the encoding succeeds using the current default encoding,\r | |
21 | # this test will fail because it does not test the right part of the\r | |
22 | # PyArg_ParseTuple() implementation.\r | |
23 | def test_with_marshal(self):\r | |
24 | arg = unicode(r'\222', 'unicode-escape')\r | |
25 | self.assertRaises(UnicodeError, marshal.loads, arg)\r | |
26 | \r | |
27 | def test_main():\r | |
28 | test_support.run_unittest(GetArgsTest)\r | |
29 | \r | |
30 | if __name__ == '__main__':\r | |
31 | test_main()\r |