Rev 2833: Fix up test_command_encoding to expect to see the assertion raised on unicode errors in http://sourcefrog.net/bzr/test-traceback

Martin Pool mbp at sourcefrog.net
Tue Sep 18 06:47:32 BST 2007


At http://sourcefrog.net/bzr/test-traceback

------------------------------------------------------------
revno: 2833
revision-id: mbp at sourcefrog.net-20070918054731-0t0117jhw02neu8h
parent: mbp at sourcefrog.net-20070918054009-ftyrlbde4dmzi40t
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: test-traceback
timestamp: Tue 2007-09-18 15:47:31 +1000
message:
  Fix up test_command_encoding to expect to see the assertion raised on unicode errors
modified:
  bzrlib/tests/blackbox/test_command_encoding.py test_command_encoding.py-20060106032110-45431fd2ce9ff21f
=== modified file 'bzrlib/tests/blackbox/test_command_encoding.py'
--- a/bzrlib/tests/blackbox/test_command_encoding.py	2007-06-26 20:32:49 +0000
+++ b/bzrlib/tests/blackbox/test_command_encoding.py	2007-09-18 05:47:31 +0000
@@ -1,5 +1,4 @@
-# Copyright (C) 2005 Canonical Ltd
-# -*- coding: utf-8 -*-
+# Copyright (C) 2005, 2007 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -35,7 +34,7 @@
 
 
 class cmd_echo_strict(cmd_echo_exact):
-    """Replace bogus unicode characters."""
+    """Raise a UnicodeError for unrepresentable characters."""
 
     encoding_type = 'strict'
 
@@ -59,7 +58,9 @@
             # get past main()
             self.assertEqual('foo\xb5', bzr('echo-exact foo\xb5'))
             # Exact should fail to decode the string
-            bzr(['echo-exact', u'foo\xb5'], retcode=3)
+            self.assertRaises(UnicodeEncodeError,
+                bzr,
+                ['echo-exact', u'foo\xb5'])
         finally:
             plugin_cmds.pop('echo-exact')
 
@@ -85,7 +86,9 @@
         try:
             self.assertEqual('foo', bzr('echo-strict foo'))
             # ascii can't encode \xb5
-            bzr(['echo-strict', u'foo\xb5'], retcode=3)
+            self.assertRaises(UnicodeEncodeError,
+                bzr,
+                ['echo-strict', u'foo\xb5'])
         finally:
             plugin_cmds.pop('echo-strict')
 




More information about the bazaar-commits mailing list