(self)
| 3089 | self.assertEqual(zopen.read(), b'222') |
| 3090 | |
| 3091 | def test_write(self): |
| 3092 | for wrapper in (lambda f: f), Tellable, Unseekable: |
| 3093 | with self.subTest(wrapper=wrapper): |
| 3094 | f = io.BytesIO() |
| 3095 | f.write(b'abc') |
| 3096 | bf = io.BufferedWriter(f) |
| 3097 | with zipfile.ZipFile(wrapper(bf), 'w', zipfile.ZIP_STORED) as zipfp: |
| 3098 | self.addCleanup(unlink, TESTFN) |
| 3099 | with open(TESTFN, 'wb') as f2: |
| 3100 | f2.write(b'111') |
| 3101 | zipfp.write(TESTFN, 'ones') |
| 3102 | with open(TESTFN, 'wb') as f2: |
| 3103 | f2.write(b'222') |
| 3104 | zipfp.write(TESTFN, 'twos') |
| 3105 | self.assertEqual(f.getvalue()[:5], b'abcPK') |
| 3106 | with zipfile.ZipFile(f, mode='r') as zipf: |
| 3107 | with zipf.open('ones') as zopen: |
| 3108 | self.assertEqual(zopen.read(), b'111') |
| 3109 | with zipf.open('twos') as zopen: |
| 3110 | self.assertEqual(zopen.read(), b'222') |
| 3111 | |
| 3112 | def test_open_write(self): |
| 3113 | for wrapper in (lambda f: f), Tellable, Unseekable: |
nothing calls this directly
no test coverage detected