diff options
author | Walter Dörwald <walter@livinglogic.de> | 2006-03-18 14:22:26 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2006-03-18 14:22:26 (GMT) |
commit | 9ae019bf5b92d9ac0ee8bb53829f6b5a16d5fab2 (patch) | |
tree | c8af173cf4d8789dc42849d1cbcb642bc79aa8ea /Modules/_testcapimodule.c | |
parent | ba8e180f3be1cd43954c7e87a45488c46f316e51 (diff) | |
download | cpython-9ae019bf5b92d9ac0ee8bb53829f6b5a16d5fab2.zip cpython-9ae019bf5b92d9ac0ee8bb53829f6b5a16d5fab2.tar.gz cpython-9ae019bf5b92d9ac0ee8bb53829f6b5a16d5fab2.tar.bz2 |
Add tests for the C APIs PyCodec_IncrementalEncoder() and
PyCodec_IncrementalDecoder().
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 6d8ea3c..263c61e 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -478,6 +478,26 @@ test_u_code(PyObject *self) return Py_None; } +static +PyObject *codec_incrementalencoder(PyObject *self, PyObject *args) +{ + const char *encoding, *errors = NULL; + if (!PyArg_ParseTuple(args, "s|s:test_incrementalencoder", + &encoding, &errors)) + return NULL; + return PyCodec_IncrementalEncoder(encoding, errors); +} + +static +PyObject *codec_incrementaldecoder(PyObject *self, PyObject *args) +{ + const char *encoding, *errors = NULL; + if (!PyArg_ParseTuple(args, "s|s:test_incrementaldecoder", + &encoding, &errors)) + return NULL; + return PyCodec_IncrementalDecoder(encoding, errors); +} + #endif /* Simple test of _PyLong_NumBits and _PyLong_Sign. */ @@ -623,6 +643,10 @@ static PyMethodDef TestMethods[] = { {"getargs_K", (PyCFunction)getargs_K, METH_VARARGS}, {"test_longlong_api", (PyCFunction)test_longlong_api, METH_NOARGS}, {"test_L_code", (PyCFunction)test_L_code, METH_NOARGS}, + {"codec_incrementalencoder", + (PyCFunction)codec_incrementalencoder, METH_VARARGS}, + {"codec_incrementaldecoder", + (PyCFunction)codec_incrementaldecoder, METH_VARARGS}, #endif #ifdef Py_USING_UNICODE {"test_u_code", (PyCFunction)test_u_code, METH_NOARGS}, |