diff options
author | Guido van Rossum <guido@python.org> | 2001-10-02 19:58:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-10-02 19:58:32 (GMT) |
commit | fe1fd0e6e9c1f253a6006ca52328d52146d89865 (patch) | |
tree | 0a80d3d688be5779884bd07ee43be3389894e9c3 /Lib | |
parent | c907bd89de2af748dfe40d829477469de47c8ee1 (diff) | |
download | cpython-fe1fd0e6e9c1f253a6006ca52328d52146d89865.zip cpython-fe1fd0e6e9c1f253a6006ca52328d52146d89865.tar.gz cpython-fe1fd0e6e9c1f253a6006ca52328d52146d89865.tar.bz2 |
pickles():
- The test for deepcopy() in pickles() was indented wrongly, so it got
run twice (one for binary pickle mode, one for text pickle mode; but
the test doesn't depend on the pickle mode).
- In verbose mode, show which subtest (pickle/cPickle/deepcopy, text/bin).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_descr.py | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index f709233..36703f5 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2081,6 +2081,8 @@ def pickles(): for p in pickle, cPickle: for bin in 0, 1: + if verbose: + print p.__name__, ["text", "binary"][bin] for cls in C, C1, C2: s = p.dumps(cls, bin) @@ -2101,24 +2103,26 @@ def pickles(): print "a = x =", a print "b = y =", b - # Testing copy.deepcopy() - import copy - for cls in C, C1, C2: - cls2 = copy.deepcopy(cls) - verify(cls2 is cls) - - a = C1(1, 2); a.append(42); a.append(24) - b = C2("hello", "world", 42) - x, y = copy.deepcopy((a, b)) - assert x.__class__ == a.__class__ - assert sorteditems(x.__dict__) == sorteditems(a.__dict__) - assert y.__class__ == b.__class__ - assert sorteditems(y.__dict__) == sorteditems(b.__dict__) - assert `x` == `a` - assert `y` == `b` - if verbose: - print "a = x =", a - print "b = y =", b + # Testing copy.deepcopy() + if verbose: + print "deepcopy" + import copy + for cls in C, C1, C2: + cls2 = copy.deepcopy(cls) + verify(cls2 is cls) + + a = C1(1, 2); a.append(42); a.append(24) + b = C2("hello", "world", 42) + x, y = copy.deepcopy((a, b)) + assert x.__class__ == a.__class__ + assert sorteditems(x.__dict__) == sorteditems(a.__dict__) + assert y.__class__ == b.__class__ + assert sorteditems(y.__dict__) == sorteditems(b.__dict__) + assert `x` == `a` + assert `y` == `b` + if verbose: + print "a = x =", a + print "b = y =", b def copies(): if verbose: print "Testing copy.copy() and copy.deepcopy()..." |