Add tests for pickling.
This commit is contained in:
parent
ab407b51c7
commit
732f181cb7
@ -796,8 +796,7 @@ static PyObject *_PylibMC_Pickle(PyObject *val) {
|
|||||||
retval = NULL;
|
retval = NULL;
|
||||||
pickle_dump = _PylibMC_GetPickles("dumps");
|
pickle_dump = _PylibMC_GetPickles("dumps");
|
||||||
if (pickle_dump != NULL) {
|
if (pickle_dump != NULL) {
|
||||||
retval = PyObject_CallFunctionObjArgs(pickle_dump, val,
|
retval = PyObject_CallFunction(pickle_dump, "Oi", val, -1);
|
||||||
PyInt_FromLong(-1), NULL);
|
|
||||||
Py_DECREF(pickle_dump);
|
Py_DECREF(pickle_dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
tests.py
11
tests.py
@ -105,8 +105,19 @@ True
|
|||||||
False
|
False
|
||||||
>>> c.delete("greta")
|
>>> c.delete("greta")
|
||||||
True
|
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.
|
# Fix up sys.path so as to include the build/lib.*/ directory.
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
Reference in New Issue
Block a user