MCPcopy Index your code
hub / github.com/python/cpython / test_write_empty_frame

Method test_write_empty_frame

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

Source from the content-addressed store, hash-verified

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

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