(self)
| 65 | os.remove(self.tmpfilepath) |
| 66 | |
| 67 | def test_seek(self): |
| 68 | # Write, then seek to arbitrary position |
| 69 | with open(self.tmpfilepath, "w+") as f: |
| 70 | f.write(self.teststring) |
| 71 | f.seek(4) |
| 72 | unpickled = pickle.loads(cloudpickle.dumps(f)) |
| 73 | # unpickled StringIO is at position 4 |
| 74 | self.assertEqual(4, unpickled.tell()) |
| 75 | self.assertEqual(self.teststring[4:], unpickled.read()) |
| 76 | # but unpickled StringIO also contained the start |
| 77 | unpickled.seek(0) |
| 78 | self.assertEqual(self.teststring, unpickled.read()) |
| 79 | os.remove(self.tmpfilepath) |
| 80 | |
| 81 | def test_pickling_special_file_handles(self): |
| 82 | # Warning: if you want to run your tests with nose, add -s option |
nothing calls this directly
no outgoing calls
no test coverage detected