[ python-Bugs-1214662 ] test_marshal.py discards marshal.load val

SourceForge.net noreply at sourceforge.net
Sat Jun 4 07:52:16 CEST 2005


Bugs item #1214662, was opened at 2005-06-04 00:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1214662&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_marshal.py discards marshal.load val

Initial Comment:
I'm working on making the marshal module work with any file-like 
object.
It's proving a bit more difficult than I imagined it would be.  At any 
rate,
several of the various test_* methods are similar in structure to
test_buffer:

    def test_buffer(self):
        for s in ["", "AndrË Previn", "abc", " "*10000]:
            b = buffer(s)
            new = marshal.loads(marshal.dumps(b))
            self.assertEqual(s, new)
            marshal.dump(b, file(test_support.TESTFN, "wb"))
            marshal.load(file(test_support.TESTFN, "rb"))
            self.assertEqual(s, new)
        os.unlink(test_support.TESTFN)

I'm thinking that throwing away the result of marshal.load has to be 
an
error (especially with the immediately following assert), and that it 
should
really be:

    def test_buffer(self):
        for s in ["", "AndrË Previn", "abc", " "*10000]:
            b = buffer(s)
            new = marshal.loads(marshal.dumps(b))
            self.assertEqual(s, new)
            marshal.dump(b, file(test_support.TESTFN, "wb"))
            new = marshal.load(file(test_support.TESTFN, "rb"))
            self.assertEqual(s, new)
        os.unlink(test_support.TESTFN)

Attached is a patch.  I'd apply it but this apparent mistake is so 
pervasive
that I thought it worth a double-check.

Skip


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1214662&group_id=5470


More information about the Python-bugs-list mailing list