def test_binary_data(self): resource_file = self._create_resource_file_with('image.gif') with open(test_helpers.fixture_path('image.gif'), 'rb') as f: assert resource_file.read() == f.read()
def test_read_can_be_called_multiple_times(self): resource_file = self._create_resource_file_with('foo.txt') content = resource_file.read() assert resource_file.read() == content
def test_unicode(self): resource_file = self._create_resource_file_with('unicode.txt') assert resource_file.read().decode('utf-8') == '万事开头难\n'
def test_it_loads_a_file(self): resource_file = self._create_resource_file_with('foo_newline_bar.txt') assert resource_file.read() == b'foo\nbar\n'