Bugs item #1214662, was opened at 2005-06-04 06:52 Message generated for change (Comment added) made by mwh 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: Accepted Priority: 5 Submitted By: Skip Montanaro (montanaro) >Assigned to: Skip Montanaro (montanaro) 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 ---------------------------------------------------------------------- >Comment By: Michael Hudson (mwh) Date: 2005-06-04 13:46 Message: Logged In: YES user_id=6656 Makes sense to me. I guess the pervasiveness has something to do with the evils of copy & paste... (I haven't run the new tests, mind) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1214662&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com