[MERGE] Make annotate behave in a non-ASCII world (v1)

Adeodato Simó dato at net.com.org.es
Fri Jul 6 18:48:23 BST 2007


Here's a small improvement to the tests:
  - don't use a codec object in the first part when it's not needed
  - actually check that the replace encoding correctly happens

New bundle attached; partial diff is:

=== modified file 'bzrlib/tests/test_annotate.py'
--- bzrlib/tests/test_annotate.py	2007-07-06 17:21:57 +0000
+++ bzrlib/tests/test_annotate.py	2007-07-06 17:45:52 +0000
@@ -317,15 +317,15 @@
                      committer=u'p\xe9rez',
                      timestamp=1166046000.00, timezone=0)
 
-        # the test passes if the annotate_file() calls below do not raise an
-        # exception
-
-        to_file = codecs.EncodedFile(StringIO(), 'utf-8')
+        # this passes if no exception is raised
+        to_file = StringIO()
         annotate.annotate_file(tree1.branch, 'rev-1', 'a-id', to_file=to_file)
 
-        to_file = codecs.getwriter('ascii')(StringIO())
+        sio = StringIO()
+        to_file = codecs.getwriter('ascii')(sio)
         to_file.encoding = 'ascii' # codecs does not set it
         annotate.annotate_file(tree1.branch, 'rev-2', 'b-id', to_file=to_file)
+        self.assertEqualDiff('2   p?rez   | bye\n', sio.getvalue())
 

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
Mankind are very odd creatures: one half censure what they practice, the
other half practice what they censure; the rest always say and do as
they ought.
                -- Michel de Montaigne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzr.annotate_fixes.diff
Type: text/x-diff
Size: 8357 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070706/7d0bb0a8/attachment.bin 


More information about the bazaar mailing list