Skip to content

Commit 5964643

Browse files
committed
Remove shape tests
1 parent 47d4ecd commit 5964643

File tree

1 file changed

+0
-188
lines changed

1 file changed

+0
-188
lines changed

Lib/test/test_zstd/test_core.py

Lines changed: 0 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -185,194 +185,6 @@ def test_decompress_2x130_1K(self):
185185
dat = decompress(DAT_130K_C + DAT_130K_C)
186186
self.assertEqual(len(dat), 2 * _130_1K)
187187

188-
class ClassShapeTestCase(unittest.TestCase):
189-
190-
def test_ZstdCompressor(self):
191-
# class attributes
192-
ZstdCompressor.CONTINUE
193-
ZstdCompressor.FLUSH_BLOCK
194-
ZstdCompressor.FLUSH_FRAME
195-
196-
# method & me_1Mer
197-
ZstdCompressor()
198-
ZstdCompressor(12, zstd_dict=TRAINED_DICT)
199-
c = ZstdCompressor(level=2, zstd_dict=TRAINED_DICT)
200-
201-
c.compress(b"123456")
202-
c.compress(b"123456", ZstdCompressor.CONTINUE)
203-
c.compress(data=b"123456", mode=c.CONTINUE)
204-
205-
c.flush()
206-
c.flush(ZstdCompressor.FLUSH_BLOCK)
207-
c.flush(mode=c.FLUSH_FRAME)
208-
209-
c.last_mode
210-
211-
# decompressor method & me_1Mer
212-
with self.assertRaises(AttributeError):
213-
c.decompress(b"")
214-
with self.assertRaises(AttributeError):
215-
c.at_frame_edge
216-
with self.assertRaises(AttributeError):
217-
c.eof
218-
with self.assertRaises(AttributeError):
219-
c.needs_input
220-
221-
# read only attribute
222-
with self.assertRaises(AttributeError):
223-
c.last_mode = ZstdCompressor.FLUSH_BLOCK
224-
225-
# name
226-
self.assertIn(".ZstdCompressor", str(type(c)))
227-
228-
# doesn't support pickle
229-
with self.assertRaises(TypeError):
230-
pickle.dumps(c)
231-
232-
# supports subclass
233-
class SubClass(ZstdCompressor):
234-
pass
235-
236-
def test_Decompressor(self):
237-
# method & me_1Mer
238-
ZstdDecompressor()
239-
ZstdDecompressor(TRAINED_DICT, {})
240-
d = ZstdDecompressor(zstd_dict=TRAINED_DICT, options={})
241-
242-
d.decompress(b"")
243-
d.decompress(b"", 100)
244-
d.decompress(data=b"", max_length=100)
245-
246-
d.eof
247-
d.needs_input
248-
d.unused_data
249-
250-
# ZstdCompressor attributes
251-
with self.assertRaises(AttributeError):
252-
d.CONTINUE
253-
with self.assertRaises(AttributeError):
254-
d.FLUSH_BLOCK
255-
with self.assertRaises(AttributeError):
256-
d.FLUSH_FRAME
257-
with self.assertRaises(AttributeError):
258-
d.compress(b"")
259-
with self.assertRaises(AttributeError):
260-
d.flush()
261-
262-
# read only attributes
263-
with self.assertRaises(AttributeError):
264-
d.eof = True
265-
with self.assertRaises(AttributeError):
266-
d.needs_input = True
267-
with self.assertRaises(AttributeError):
268-
d.unused_data = b""
269-
270-
# name
271-
self.assertIn(".ZstdDecompressor", str(type(d)))
272-
273-
# doesn't support pickle
274-
with self.assertRaises(TypeError):
275-
pickle.dumps(d)
276-
277-
# supports subclass
278-
class SubClass(ZstdDecompressor):
279-
pass
280-
281-
def test_ZstdDict(self):
282-
ZstdDict(b"12345678", True)
283-
zd = ZstdDict(b"12345678", is_raw=True)
284-
285-
self.assertEqual(type(zd.dict_content), bytes)
286-
self.assertEqual(zd.dict_id, 0)
287-
self.assertEqual(zd.as_digested_dict[1], 0)
288-
self.assertEqual(zd.as_undigested_dict[1], 1)
289-
self.assertEqual(zd.as_prefix[1], 2)
290-
291-
# name
292-
self.assertIn(".ZstdDict", str(type(zd)))
293-
294-
# doesn't support pickle
295-
with self.assertRaisesRegex(TypeError, r"cannot pickle"):
296-
pickle.dumps(zd)
297-
with self.assertRaisesRegex(TypeError, r"cannot pickle"):
298-
pickle.dumps(zd.as_prefix)
299-
300-
# supports subclass
301-
class SubClass(ZstdDict):
302-
pass
303-
304-
def test_Strategy(self):
305-
# class attributes
306-
Strategy.fast
307-
Strategy.dfast
308-
Strategy.greedy
309-
Strategy.lazy
310-
Strategy.lazy2
311-
Strategy.btlazy2
312-
Strategy.btopt
313-
Strategy.btultra
314-
Strategy.btultra2
315-
316-
def test_CParameter(self):
317-
CParameter.compressionLevel
318-
CParameter.windowLog
319-
CParameter.hashLog
320-
CParameter.chainLog
321-
CParameter.searchLog
322-
CParameter.minMatch
323-
CParameter.targetLength
324-
CParameter.strategy
325-
with self.assertRaises(NotImplementedError):
326-
CParameter.targetCBlockSize
327-
328-
CParameter.enableLongDistanceMatching
329-
CParameter.ldmHashLog
330-
CParameter.ldmMinMatch
331-
CParameter.ldmBucketSizeLog
332-
CParameter.ldmHashRateLog
333-
334-
CParameter.contentSizeFlag
335-
CParameter.checksumFlag
336-
CParameter.dictIDFlag
337-
338-
CParameter.nbWorkers
339-
CParameter.jobSize
340-
CParameter.overlapLog
341-
342-
t = CParameter.windowLog.bounds()
343-
self.assertEqual(len(t), 2)
344-
self.assertEqual(type(t[0]), int)
345-
self.assertEqual(type(t[1]), int)
346-
347-
def test_DParameter(self):
348-
DParameter.windowLogMax
349-
350-
t = DParameter.windowLogMax.bounds()
351-
self.assertEqual(len(t), 2)
352-
self.assertEqual(type(t[0]), int)
353-
self.assertEqual(type(t[1]), int)
354-
355-
def test_zstderror_pickle(self):
356-
try:
357-
decompress(b"invalid data")
358-
except Exception as e:
359-
s = pickle.dumps(e)
360-
obj = pickle.loads(s)
361-
self.assertEqual(type(obj), ZstdError)
362-
else:
363-
self.assertFalse(True, "unreachable code path")
364-
365-
def test_ZstdFile_extend(self):
366-
# These classes and variables can be used to extend ZstdFile,
367-
# so pin them down.
368-
self.assertTrue(issubclass(ZstdFile, io.BufferedIOBase))
369-
self.assertIs(ZstdFile._READER_CLASS, _streams.DecompressReader)
370-
371-
# mode
372-
self.assertEqual(zstdfile._MODE_CLOSED, 0)
373-
self.assertEqual(zstdfile._MODE_READ, 1)
374-
self.assertEqual(zstdfile._MODE_WRITE, 2)
375-
376188

377189
class CompressorTestCase(unittest.TestCase):
378190

0 commit comments

Comments
 (0)