equal
deleted
inserted
replaced
5 import zstandard as zstd |
5 import zstandard as zstd |
6 |
6 |
7 from . common import ( |
7 from . common import ( |
8 generate_samples, |
8 generate_samples, |
9 make_cffi, |
9 make_cffi, |
|
10 random_input_data, |
10 ) |
11 ) |
11 |
12 |
12 if sys.version_info[0] >= 3: |
13 if sys.version_info[0] >= 3: |
13 int_type = int |
14 int_type = int |
14 else: |
15 else: |
27 |
28 |
28 with self.assertRaises(ValueError): |
29 with self.assertRaises(ValueError): |
29 zstd.train_dictionary(8192, [u'foo']) |
30 zstd.train_dictionary(8192, [u'foo']) |
30 |
31 |
31 def test_no_params(self): |
32 def test_no_params(self): |
32 d = zstd.train_dictionary(8192, generate_samples()) |
33 d = zstd.train_dictionary(8192, random_input_data()) |
33 self.assertIsInstance(d.dict_id(), int_type) |
34 self.assertIsInstance(d.dict_id(), int_type) |
34 |
35 |
35 # The dictionary ID may be different across platforms. |
36 # The dictionary ID may be different across platforms. |
36 expected = b'\x37\xa4\x30\xec' + struct.pack('<I', d.dict_id()) |
37 expected = b'\x37\xa4\x30\xec' + struct.pack('<I', d.dict_id()) |
37 |
38 |