##// END OF EJS Templates
misc: update year in copyright lines...
misc: update year in copyright lines This patch also makes some expected output lines in tests glob-ed for persistence of them. BTW, files below aren't yet changed in 2017, but this patch also updates copyright of them, because: - mercurial/help/hg.1.txt almost all of "man hg" output comes from online help of hg command, and is already changed in 2017 - mercurial/help/hgignore.5.txt - mercurial/help/hgrc.5 "copyright 2005-201X Matt Mackall" in them mentions about copyright of Mercurial itself

File last commit:

r30435:b86a448a default
r30907:75149f84 stable
Show More
test_cffi.py
35 lines | 838 B | text/x-python | PythonLexer
import io
try:
import unittest2 as unittest
except ImportError:
import unittest
import zstd
try:
import zstd_cffi
except ImportError:
raise unittest.SkipTest('cffi version of zstd not available')
class TestCFFIWriteToToCDecompressor(unittest.TestCase):
def test_simple(self):
orig = io.BytesIO()
orig.write(b'foo')
orig.write(b'bar')
orig.write(b'foobar' * 16384)
dest = io.BytesIO()
cctx = zstd_cffi.ZstdCompressor()
with cctx.write_to(dest) as compressor:
compressor.write(orig.getvalue())
uncompressed = io.BytesIO()
dctx = zstd.ZstdDecompressor()
with dctx.write_to(uncompressed) as decompressor:
decompressor.write(dest.getvalue())
self.assertEqual(uncompressed.getvalue(), orig.getvalue())