~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_command_encoding.py

  • Committer: Alexander Belchenko
  • Date: 2007-10-04 05:50:44 UTC
  • mfrom: (2881 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2884.
  • Revision ID: bialix@ukr.net-20071004055044-pb88kgkfayawro8n
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
2
 
# -*- coding: utf-8 -*-
 
1
# Copyright (C) 2005, 2007 Canonical Ltd
3
2
#
4
3
# This program is free software; you can redistribute it and/or modify
5
4
# it under the terms of the GNU General Public License as published by
35
34
 
36
35
 
37
36
class cmd_echo_strict(cmd_echo_exact):
38
 
    """Replace bogus unicode characters."""
 
37
    """Raise a UnicodeError for unrepresentable characters."""
39
38
 
40
39
    encoding_type = 'strict'
41
40
 
59
58
            # get past main()
60
59
            self.assertEqual('foo\xb5', bzr('echo-exact foo\xb5'))
61
60
            # Exact should fail to decode the string
62
 
            bzr(['echo-exact', u'foo\xb5'], retcode=3)
 
61
            self.assertRaises(UnicodeEncodeError,
 
62
                bzr,
 
63
                ['echo-exact', u'foo\xb5'])
63
64
        finally:
64
65
            plugin_cmds.pop('echo-exact')
65
66
 
85
86
        try:
86
87
            self.assertEqual('foo', bzr('echo-strict foo'))
87
88
            # ascii can't encode \xb5
88
 
            bzr(['echo-strict', u'foo\xb5'], retcode=3)
 
89
            self.assertRaises(UnicodeEncodeError,
 
90
                bzr,
 
91
                ['echo-strict', u'foo\xb5'])
89
92
        finally:
90
93
            plugin_cmds.pop('echo-strict')
91
94