# Path: dtformats/data_range.py
# class DataRange(object):
#   def __init__(self, file_object, data_offset=0, data_size=0):
#   def read(self, size=None):
#   def seek(self, offset, whence=os.SEEK_SET):
#   def get_offset(self):
#   def tell(self):
#   def get_size(self):
#   def seekable(self):
# 
# Path: tests/test_lib.py
# class BaseTestCase(unittest.TestCase):
# class TestOutputWriter(output_writers.OutputWriter):
#   _TEST_DATA_PATH = os.path.join(os.getcwd(), 'test_data')
#   def _GetTestFilePath(self, path_segments):
#   def _SkipIfPathNotExists(self, path):
#   def __init__(self):
#   def Close(self):
#   def Open(self):
#   def WriteText(self, text):


import io
import os
import unittest
from dtformats import data_range
from tests import test_lib
    file_object = io.BytesIO(self._FILE_DATA)
    test_range = data_range.DataRange(
        file_object, data_offset=32, data_size=64)

    byte_stream = test_range.read(size=1)
    self.assertEqual(byte_stream, b'\x20')

    byte_stream = test_range.read()
    self.assertEqual(len(byte_stream), 63)

    byte_stream = test_range.read()
    self.assertEqual(byte_stream, b'')

    test_range.data_offset = -1

    with self.assertRaises(IOError):
      test_range.read()

    test_range.data_offset = 32

    test_range.data_size = -1

    with self.assertRaises(IOError):
      test_range.read()

    test_range.data_offset = 64

  def testSeek(self):
    """Tests the seek function."""
    file_object = io.BytesIO(self._FILE_DATA)

# Path: dtformats/data_range.py
# class DataRange(object):
#   def __init__(self, file_object, data_offset=0, data_size=0):
#   def read(self, size=None):
#   def seek(self, offset, whence=os.SEEK_SET):
#   def get_offset(self):
#   def tell(self):
#   def get_size(self):
#   def seekable(self):
# 
# Path: tests/test_lib.py
# class BaseTestCase(unittest.TestCase):
# class TestOutputWriter(output_writers.OutputWriter):
#   _TEST_DATA_PATH = os.path.join(os.getcwd(), 'test_data')
#   def _GetTestFilePath(self, path_segments):
#   def _SkipIfPathNotExists(self, path):
#   def __init__(self):
#   def Close(self):
#   def Open(self):
#   def WriteText(self, text):


# Path: tests/data_range.py
import io
import os
import unittest
from dtformats import data_range
from tests import test_lib

    file_object = io.BytesIO(self._FILE_DATA)
    test_range = data_range.DataRange(
        file_object, data_offset=32, data_size=64)

    byte_stream = test_range.read(size=1)
    self.assertEqual(byte_stream, b'\x20')

    byte_stream = test_range.read()
    self.assertEqual(len(byte_stream), 63)

    byte_stream = test_range.read()
    self.assertEqual(byte_stream, b'')

    test_range.data_offset = -1

    with self.assertRaises(IOError):
      test_range.read()

    test_range.data_offset = 32

    test_range.data_size = -1

    with self.assertRaises(IOError):
      test_range.read()

    test_range.data_offset = 64

  def testSeek(self):
    """Tests the seek function."""
    file_object = io.BytesIO(self._FILE_DATA)

    test_range = data_range.DataRange(