MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_write_empty_frame

Method test_write_empty_frame

Lib/test/test_zstd.py:2118–2145  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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''.

Callers

nothing calls this directly

Calls 6

getvalueMethod · 0.95
ZstdFileClass · 0.90
assertNotEqualMethod · 0.80
flushMethod · 0.45
assertEqualMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected