diff --git a/oslo_i18n/_message.py b/oslo_i18n/_message.py index 9dff366..d03337d 100644 --- a/oslo_i18n/_message.py +++ b/oslo_i18n/_message.py @@ -228,13 +228,3 @@ class Message(six.text_type): def __radd__(self, other): return self.__add__(other) - - if six.PY2: - def __str__(self): - # NOTE(luisg): Logging in python 2.6 tries to str() log records, - # and it expects specifically a UnicodeError in order to proceed. - from oslo_i18n._i18n import _ - msg = _('Message objects do not support str() because they may ' - 'contain non-ascii characters. ' - 'Please use unicode() or translate() instead.') - raise UnicodeError(msg) diff --git a/oslo_i18n/tests/test_message.py b/oslo_i18n/tests/test_message.py index 47dd365..ba7851f 100644 --- a/oslo_i18n/tests/test_message.py +++ b/oslo_i18n/tests/test_message.py @@ -303,12 +303,6 @@ class MessageTestCase(test_base.BaseTestCase): test_me = lambda: utils.SomeObject('test') + _message.Message(msgid) self.assertRaises(TypeError, test_me) - @testtools.skipIf(six.PY3, 'test specific to Python 2') - def test_str_disabled(self): - msgid = "A message" - test_me = lambda: str(_message.Message(msgid)) - self.assertRaises(UnicodeError, test_me) - @mock.patch('gettext.translation') def test_translate(self, mock_translation): en_message = 'A message in the default locale'