Skip to content

Commit

Permalink
test: Update unittest for SectionReader changes
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <xuanwo@yunify.com>
  • Loading branch information
Xuanwo committed Sep 28, 2017
1 parent 4e436b5 commit e17cd36
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" %
Expand Down Expand Up @@ -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"))
Expand All @@ -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")

Expand Down

0 comments on commit e17cd36

Please sign in to comment.