Add tests for pickling.

This commit is contained in:
lericson 2009-09-08 21:43:56 +02:00
parent ab407b51c7
commit 732f181cb7
2 changed files with 12 additions and 2 deletions

View File

@ -796,8 +796,7 @@ static PyObject *_PylibMC_Pickle(PyObject *val) {
retval = NULL;
pickle_dump = _PylibMC_GetPickles("dumps");
if (pickle_dump != NULL) {
retval = PyObject_CallFunctionObjArgs(pickle_dump, val,
PyInt_FromLong(-1), NULL);
retval = PyObject_CallFunction(pickle_dump, "Oi", val, -1);
Py_DECREF(pickle_dump);
}

View File

@ -105,8 +105,19 @@ True
False
>>> c.delete("greta")
True
Complex data types!
>>> bla = Foo()
>>> bla.bar = "Hello!"
>>> c.set("tengil", bla)
True
>>> c.get("tengil").bar == bla.bar
True
"""
# Used to test pickling.
class Foo(object): pass
# Fix up sys.path so as to include the build/lib.*/ directory.
import sys
import os