From e17cd369713939afa83903780fbdaaca0b9ce1ba Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Thu, 28 Sep 2017 14:46:02 +0800 Subject: [PATCH] test: Update unittest for SectionReader changes Signed-off-by: Xuanwo --- tests/test_utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 36309426..cfa7ba55 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -54,7 +54,7 @@ def setUp(self): self.conf_file = conf_file self.bad_conf_file = bad_conf_file - # Create a large file(~64MB) + # Create a large file(~128MB) self.large_file = os.path.join(current_path, "data/large_file") command = ( "dd if=/dev/urandom of=%s bs=%s count=2 > /dev/null 2>&1" % @@ -101,7 +101,7 @@ def test_join_local_path(self): def test_format_size(self): size = os.path.getsize(self.large_file) - self.assertEqual(format_size(size), "64.0 MiB") + self.assertEqual(format_size(size), "128.0 MiB") def test_pattern_match(self): self.assertTrue(pattern_match("xyz", "x?z")) @@ -118,9 +118,11 @@ def test_is_pattern_match(self): def test_File_Chunk(self): with open(self.large_file, "rb") as f: file = FileChunk(f) - (_, part0), (_, part1), (_, part2) = file.iter() + (_, part0) = next(file.iter()) self.assertEqual(len(part0.read()), PART_SIZE) + (_, part1) = next(file.iter(1)) self.assertEqual(len(part1.read()), PART_SIZE) + (_, part2) = next(file.iter(2)) self.assertEqual(part2.read(5), b"just ") self.assertEqual(part2.read(), b"for testing")