Mercurial > hg
comparison contrib/python-zstandard/tests/test_module_attributes.py @ 37495:b1fb341d8a61
zstandard: vendor python-zstandard 0.9.0
This was just released. It features a number of goodies. More info at
https://gregoryszorc.com/blog/2018/04/09/release-of-python-zstandard-0.9/.
The clang-format ignore list was updated to reflect the new source
of files.
The project contains a vendored copy of zstandard 1.3.4. The old
version was 1.1.3. One of the changes between those versions is that
zstandard is now dual licensed BSD + GPLv2 and the patent rights grant
has been removed. Good riddance.
The API should be backwards compatible. So no changes in core
should be needed. However, there were a number of changes in the
library that we'll want to adapt to. Those will be addressed in
subsequent commits.
Differential Revision: https://phab.mercurial-scm.org/D3198
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 09 Apr 2018 10:13:29 -0700 |
parents | c32454d69b85 |
children | 73fef626dae3 |
comparison
equal
deleted
inserted
replaced
37494:1ce7a55b09d1 | 37495:b1fb341d8a61 |
---|---|
1 from __future__ import unicode_literals | 1 from __future__ import unicode_literals |
2 | 2 |
3 try: | 3 import unittest |
4 import unittest2 as unittest | |
5 except ImportError: | |
6 import unittest | |
7 | 4 |
8 import zstd | 5 import zstandard as zstd |
9 | 6 |
10 from . common import ( | 7 from . common import ( |
11 make_cffi, | 8 make_cffi, |
12 ) | 9 ) |
13 | 10 |
14 | 11 |
15 @make_cffi | 12 @make_cffi |
16 class TestModuleAttributes(unittest.TestCase): | 13 class TestModuleAttributes(unittest.TestCase): |
17 def test_version(self): | 14 def test_version(self): |
18 self.assertEqual(zstd.ZSTD_VERSION, (1, 1, 3)) | 15 self.assertEqual(zstd.ZSTD_VERSION, (1, 3, 4)) |
19 | 16 |
20 def test_constants(self): | 17 def test_constants(self): |
21 self.assertEqual(zstd.MAX_COMPRESSION_LEVEL, 22) | 18 self.assertEqual(zstd.MAX_COMPRESSION_LEVEL, 22) |
22 self.assertEqual(zstd.FRAME_HEADER, b'\x28\xb5\x2f\xfd') | 19 self.assertEqual(zstd.FRAME_HEADER, b'\x28\xb5\x2f\xfd') |
23 | 20 |
24 def test_hasattr(self): | 21 def test_hasattr(self): |
25 attrs = ( | 22 attrs = ( |
23 'CONTENTSIZE_UNKNOWN', | |
24 'CONTENTSIZE_ERROR', | |
26 'COMPRESSION_RECOMMENDED_INPUT_SIZE', | 25 'COMPRESSION_RECOMMENDED_INPUT_SIZE', |
27 'COMPRESSION_RECOMMENDED_OUTPUT_SIZE', | 26 'COMPRESSION_RECOMMENDED_OUTPUT_SIZE', |
28 'DECOMPRESSION_RECOMMENDED_INPUT_SIZE', | 27 'DECOMPRESSION_RECOMMENDED_INPUT_SIZE', |
29 'DECOMPRESSION_RECOMMENDED_OUTPUT_SIZE', | 28 'DECOMPRESSION_RECOMMENDED_OUTPUT_SIZE', |
30 'MAGIC_NUMBER', | 29 'MAGIC_NUMBER', |
38 'SEARCHLOG_MIN', | 37 'SEARCHLOG_MIN', |
39 'SEARCHLOG_MAX', | 38 'SEARCHLOG_MAX', |
40 'SEARCHLENGTH_MIN', | 39 'SEARCHLENGTH_MIN', |
41 'SEARCHLENGTH_MAX', | 40 'SEARCHLENGTH_MAX', |
42 'TARGETLENGTH_MIN', | 41 'TARGETLENGTH_MIN', |
43 'TARGETLENGTH_MAX', | 42 'LDM_MINMATCH_MIN', |
43 'LDM_MINMATCH_MAX', | |
44 'LDM_BUCKETSIZELOG_MAX', | |
44 'STRATEGY_FAST', | 45 'STRATEGY_FAST', |
45 'STRATEGY_DFAST', | 46 'STRATEGY_DFAST', |
46 'STRATEGY_GREEDY', | 47 'STRATEGY_GREEDY', |
47 'STRATEGY_LAZY', | 48 'STRATEGY_LAZY', |
48 'STRATEGY_LAZY2', | 49 'STRATEGY_LAZY2', |
49 'STRATEGY_BTLAZY2', | 50 'STRATEGY_BTLAZY2', |
50 'STRATEGY_BTOPT', | 51 'STRATEGY_BTOPT', |
52 'STRATEGY_BTULTRA', | |
53 'DICT_TYPE_AUTO', | |
54 'DICT_TYPE_RAWCONTENT', | |
55 'DICT_TYPE_FULLDICT', | |
51 ) | 56 ) |
52 | 57 |
53 for a in attrs: | 58 for a in attrs: |
54 self.assertTrue(hasattr(zstd, a), a) | 59 self.assertTrue(hasattr(zstd, a), a) |