Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(261658)

Side by Side Diff: Lib/test/test_bz2.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_builtin.py ('k') | Lib/test/test_capi.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 from test import support 1 from test import support
2 from test.support import bigmemtest, _4G 2 from test.support import bigmemtest, _4G
3 3
4 import unittest 4 import unittest
5 from io import BytesIO 5 from io import BytesIO
6 import os 6 import os
7 import pickle 7 import pickle
8 import random 8 import random
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 @bigmemtest(size=_4G + 100, memuse=3.3) 688 @bigmemtest(size=_4G + 100, memuse=3.3)
689 def testDecompress4G(self, size): 689 def testDecompress4G(self, size):
690 # "Test BZ2Decompressor.decompress() with >4GiB input" 690 # "Test BZ2Decompressor.decompress() with >4GiB input"
691 blocksize = 10 * 1024 * 1024 691 blocksize = 10 * 1024 * 1024
692 block = random.getrandbits(blocksize * 8).to_bytes(blocksize, 'little') 692 block = random.getrandbits(blocksize * 8).to_bytes(blocksize, 'little')
693 try: 693 try:
694 data = block * (size // blocksize + 1) 694 data = block * (size // blocksize + 1)
695 compressed = bz2.compress(data) 695 compressed = bz2.compress(data)
696 bz2d = BZ2Decompressor() 696 bz2d = BZ2Decompressor()
697 decompressed = bz2d.decompress(compressed) 697 decompressed = bz2d.decompress(compressed)
698 self.assertTrue(decompressed == data) 698 self.assertEqual(decompressed, data)
699 finally: 699 finally:
700 data = None 700 data = None
701 compressed = None 701 compressed = None
702 decompressed = None 702 decompressed = None
703 703
704 def testPickle(self): 704 def testPickle(self):
705 with self.assertRaises(TypeError): 705 with self.assertRaises(TypeError):
706 pickle.dumps(BZ2Decompressor()) 706 pickle.dumps(BZ2Decompressor())
707 707
708 708
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 BZ2FileTest, 871 BZ2FileTest,
872 BZ2CompressorTest, 872 BZ2CompressorTest,
873 BZ2DecompressorTest, 873 BZ2DecompressorTest,
874 CompressDecompressTest, 874 CompressDecompressTest,
875 OpenTest, 875 OpenTest,
876 ) 876 )
877 support.reap_children() 877 support.reap_children()
878 878
879 if __name__ == '__main__': 879 if __name__ == '__main__':
880 test_main() 880 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_builtin.py ('k') | Lib/test/test_capi.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+