def test_get_file_length(self): # make sure get_file_length works as expected path = os.path.join(self.tempdir, 'testfile1') open(path, 'w').write('1234567890') self.assertEqual( get_file_length(open(path, 'rb')), 10) return
def test_get_file_length_zero_length(self): # make sure get_file_length works as expected with zero length path = os.path.join(self.tempdir, 'testfile1') fd = open(path, 'w') fd.close() self.assertEqual( get_file_length(open(path, 'rb')), 0) return