(self)
| 2145 | self.assertNotEqual(bo.getvalue(), b'') |
| 2146 | |
| 2147 | def test_write_empty_block(self): |
| 2148 | # If no internal data, .FLUSH_BLOCK return b''. |
| 2149 | c = ZstdCompressor() |
| 2150 | self.assertEqual(c.flush(c.FLUSH_BLOCK), b'') |
| 2151 | self.assertNotEqual(c.compress(b'123', c.FLUSH_BLOCK), |
| 2152 | b'') |
| 2153 | self.assertEqual(c.flush(c.FLUSH_BLOCK), b'') |
| 2154 | self.assertEqual(c.compress(b''), b'') |
| 2155 | self.assertEqual(c.compress(b''), b'') |
| 2156 | self.assertEqual(c.flush(c.FLUSH_BLOCK), b'') |
| 2157 | |
| 2158 | # mode = .last_mode |
| 2159 | bo = io.BytesIO() |
| 2160 | with ZstdFile(bo, 'w') as f: |
| 2161 | f.write(b'123') |
| 2162 | f.flush(f.FLUSH_BLOCK) |
| 2163 | fp_pos = f._fp.tell() |
| 2164 | self.assertNotEqual(fp_pos, 0) |
| 2165 | f.flush(f.FLUSH_BLOCK) |
| 2166 | self.assertEqual(f._fp.tell(), fp_pos) |
| 2167 | |
| 2168 | # mode != .last_mode |
| 2169 | bo = io.BytesIO() |
| 2170 | with ZstdFile(bo, 'w') as f: |
| 2171 | f.flush(f.FLUSH_BLOCK) |
| 2172 | self.assertEqual(f._fp.tell(), 0) |
| 2173 | f.write(b'') |
| 2174 | f.flush(f.FLUSH_BLOCK) |
| 2175 | self.assertEqual(f._fp.tell(), 0) |
| 2176 | |
| 2177 | def test_write_101(self): |
| 2178 | with io.BytesIO() as dst: |
nothing calls this directly
no test coverage detected