]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_getargs.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / test / test_getargs.py
CommitLineData
4710c53d 1"""\r
2Test the internal getargs.c implementation\r
3\r
4 PyArg_ParseTuple() is defined here.\r
5\r
6The test here is not intended to test all of the module, just the\r
7single 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
15import marshal\r
16import unittest\r
17from test import test_support\r
18\r
19class 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
27def test_main():\r
28 test_support.run_unittest(GetArgsTest)\r
29\r
30if __name__ == '__main__':\r
31 test_main()\r