Commits

Anonymous committed debbc6c

project: added File.read_bytes()

  • Participants
  • Parent commits 7e9787a

Comments (0)

Files changed (2)

rope/base/project.py

+import cPickle as pickle
 import os
 import re
 import shutil
-import cPickle as pickle
 import warnings
 
 import rope.base.change
 from rope.base import exceptions, taskhandle, prefs, history, pycore
 from rope.base.resourceobserver import *
 from rope.base.resources import File, Folder
-from rope.refactor.sourceutils import add_methods
 
 
 class _Project(object):

ropetest/projecttest.py

         file.close()
         self.assertEquals(contents, sample_file.read().encode('latin-1'))
 
+    def test_read_bytes(self):
+        sample_file = self.project.root.create_file('my_file.txt')
+        contents = '\n# -*- coding: latin-1 -*-\n\xa9\n'
+        file = open(sample_file.real_path, 'wb')
+        file.write(contents)
+        file.close()
+        self.assertEquals(contents, sample_file.read_bytes())
+
     # TODO: Detecting utf-16 encoding
     def xxx_test_using_utf16(self):
         sample_file = self.project.root.create_file('my_file.txt')