summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getargs.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-03-18 01:00:07 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-03-18 01:00:07 (GMT)
commit6eeaddc341ec3ac03070c47cf9095a6c82d3a395 (patch)
tree095a6e07a27e4a63011e18a94a927d476442eba9 /Lib/test/test_getargs.py
parent887290d275a68754aa15a9924640faab392754b6 (diff)
downloadcpython-6eeaddc341ec3ac03070c47cf9095a6c82d3a395.zip
cpython-6eeaddc341ec3ac03070c47cf9095a6c82d3a395.tar.gz
cpython-6eeaddc341ec3ac03070c47cf9095a6c82d3a395.tar.bz2
Convert test_strftime, test_getargs, and test_pep247 to use unittest.
Diffstat (limited to 'Lib/test/test_getargs.py')
-rw-r--r--Lib/test/test_getargs.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/Lib/test/test_getargs.py b/Lib/test/test_getargs.py
index 4ce34bc..e2c36dd 100644
--- a/Lib/test/test_getargs.py
+++ b/Lib/test/test_getargs.py
@@ -1,4 +1,5 @@
-"""Test the internal getargs.c implementation
+"""
+Test the internal getargs.c implementation
PyArg_ParseTuple() is defined here.
@@ -11,14 +12,23 @@ single case that failed between 2.1 and 2.2a2.
# verify that the error is propagated properly from the C code back to
# Python.
-# XXX If the encoding succeeds using the current default encoding,
-# this test will fail because it does not test the right part of the
-# PyArg_ParseTuple() implementation.
-from test.test_support import have_unicode
import marshal
+import unittest
+from test import test_support
+
+class GetArgsTest(unittest.TestCase):
+ # If the encoding succeeds using the current default encoding,
+ # this test will fail because it does not test the right part of the
+ # PyArg_ParseTuple() implementation.
+ def test_with_marshal(self):
+ if not test_support.have_unicode:
+ return
+
+ arg = unicode(r'\222', 'unicode-escape')
+ self.assertRaises(UnicodeError, marshal.loads, arg)
+
+def test_main():
+ test_support.run_unittest(GetArgsTest)
-if have_unicode:
- try:
- marshal.loads(unicode(r"\222", 'unicode-escape'))
- except UnicodeError:
- pass
+if __name__ == '__main__':
+ test_main()