(self)
| 2116 | self.assertEqual(dst.getvalue(), expected) |
| 2117 | |
| 2118 | def test_write_empty_frame(self): |
| 2119 | # .FLUSH_FRAME generates an empty content frame |
| 2120 | c = ZstdCompressor() |
| 2121 | self.assertNotEqual(c.flush(c.FLUSH_FRAME), b'') |
| 2122 | self.assertNotEqual(c.flush(c.FLUSH_FRAME), b'') |
| 2123 | |
| 2124 | # don't generate empty content frame |
| 2125 | bo = io.BytesIO() |
| 2126 | with ZstdFile(bo, 'w') as f: |
| 2127 | pass |
| 2128 | self.assertEqual(bo.getvalue(), b'') |
| 2129 | |
| 2130 | bo = io.BytesIO() |
| 2131 | with ZstdFile(bo, 'w') as f: |
| 2132 | f.flush(f.FLUSH_FRAME) |
| 2133 | self.assertEqual(bo.getvalue(), b'') |
| 2134 | |
| 2135 | # if .write(b''), generate empty content frame |
| 2136 | bo = io.BytesIO() |
| 2137 | with ZstdFile(bo, 'w') as f: |
| 2138 | f.write(b'') |
| 2139 | self.assertNotEqual(bo.getvalue(), b'') |
| 2140 | |
| 2141 | # has an empty content frame |
| 2142 | bo = io.BytesIO() |
| 2143 | with ZstdFile(bo, 'w') as f: |
| 2144 | f.flush(f.FLUSH_BLOCK) |
| 2145 | self.assertNotEqual(bo.getvalue(), b'') |
| 2146 | |
| 2147 | def test_write_empty_block(self): |
| 2148 | # If no internal data, .FLUSH_BLOCK return b''. |
nothing calls this directly
no test coverage detected