Commit Graph

22 Commits

Author SHA1 Message Date
Collin Winter f8089c7789 Issue 5665: add more pickling tests.
- Add tests for the module-level load() and dump() functions.
- Add tests for cPickle's internal data structures, stressing workloads
with many gets/puts.
- Add tests for the Pickler and Unpickler classes, in particular the
memo attribute.
- test_xpickle is extended to test backwards compatibility with Python
2.4, 2.5 and 2.6 by round-tripping pickled objects through a worker
process. This is guarded with a regrtest -u xpickle resource.
2009-04-09 16:46:46 +00:00
Benjamin Peterson 704dc269e3 AttributeError can be thrown during recursion errors 2009-03-22 22:24:58 +00:00
Facundo Batista 763d309bba Fix #2702, with a correct accounting of recursion. 2008-06-30 01:10:55 +00:00
Facundo Batista 68dc052ca6 Reverting the patch from #3165, as it broke other
behaviours. I left the original test commented out (note
that that test came from #2702, which seems to have a
problem in FreeBSD and Windows, but not in Linux).

I included a new test, to watch over the now-broken
behaviour, I took it from #3179.
2008-06-25 19:24:53 +00:00
Facundo Batista 9da18b3133 Fixing the problem stated in issue 2702 with the patch submitted
in the issue 3165. Now cPickle does not fails with uncontrolled
behaviour when pickling into a very deep nested structure.
2008-06-22 23:19:14 +00:00
Christian Heimes c5f05e45cf Patch #2167 from calvin: Remove unused imports 2008-02-23 17:40:11 +00:00
Neal Norwitz cdb7948f97 Use absolute import. 2006-03-24 08:58:38 +00:00
Walter Dörwald 21d3a32b99 Combine the functionality of test_support.run_unittest()
and test_support.run_classtests() into run_unittest()
and use it wherever possible.

Also don't use "from test.test_support import ...", but
"from test import test_support" in a few spots.

From SF patch #662807.
2003-05-01 17:45:56 +00:00
Tim Peters 7107a7fbcc SF bug 690622: test_cpickle overflows stack on MacOS9.
test_nonrecursive_deep():  Reduced nesting depth to 60.

Not a bugfix candidate.  2.3 increased the number of stack frames
needed to pickle a list (in order to get implement the "list
batching" unpickling memory optimization new in 2.3).
2003-02-21 20:14:35 +00:00
Tim Peters dcaa24e503 Renamed "bin" arguments to "proto". Note that this test currently
fails, for reasons unrelated to this patch.
2003-01-28 22:26:28 +00:00
Barry Warsaw 04f357cffe Get rid of relative imports in all unittests. Now anything that
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".

This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).

Now Tim and Jack can have at it. :)
2002-07-23 19:04:11 +00:00
Barry Warsaw 52acb49298 Merge of the release22 branch changes back into the trunk. 2001-12-21 20:04:22 +00:00
Fred Drake 694ed091af Fix the test control support for the pickle & cPickle tests so the tests run
under regrtest.
2001-12-19 16:42:15 +00:00
Tim Peters e0c446bb4a Whitespace normalization. 2001-10-18 21:57:37 +00:00
Jeremy Hylton 6642653875 Covert pickle tests to use unittest.
Extend tests to cover a few more cases.  For cPickle, test several of
the undocumented features.
2001-10-15 21:38:56 +00:00
Tim Peters e935816164 Reorganize pickle/cPickle testing so the tests pass regardless of the order
they're run.
2001-01-22 22:05:20 +00:00
Jeremy Hylton be467e5c69 Fix Bug #114293:
Strings are unpickled by calling eval on the string's repr. This
    change makes pickle work like cPickle; it checks if the pickled
    string is safe to eval and raises ValueError if it is not.

test suite modifications:
    Verify that pickle catches a variety of insecure string pickles
    Make test_pickle and test_cpickle use exactly the same test suite
    Add test for pickling recursive object
2000-09-15 15:14:51 +00:00
Guido van Rossum 84219682fb Charles Waldman writes:
"""
In the course of debugging this I also saw that cPickle is
inconsistent with pickle - if you attempt a pickle.load or pickle.dump
on a closed file, you get a ValueError, whereas the corresponding
cPickle operations give an IOError.  Since cPickle is advertised as
being compatible with pickle, I changed these exceptions to match.
"""
2000-04-21 20:49:58 +00:00
Guido van Rossum ba508a21e0 Add test case for bug just fixed by Stephen Turner. 1999-07-13 15:23:42 +00:00
Guido van Rossum 8ff764f113 Jonathan Giddy write:
In test_cpickle.py, the module os got imported, but the line to remove
the temp file has gone missing.
1999-04-01 15:32:30 +00:00
Guido van Rossum 89ae2b9f07 Test protection against picling to/from closed (real) file. 1999-03-29 19:59:32 +00:00
Guido van Rossum aa3828aa35 Basic regr tests for pickle/cPickle 1999-03-25 22:38:49 +00:00