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