Skip to content

Commit

Permalink
use explicit \uXXXX for embedded unicode characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin J. Mitchell committed Mar 13, 2010
1 parent 0fb4d4d commit 7cc0ceb
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions buildbot/test/unit/test_status_mail_MailNotifier.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from twisted.trial import unittest

from buildbot.status.builder import SUCCESS
Expand All @@ -23,22 +21,22 @@ def getText(self):

class TestMailNotifier(unittest.TestCase):
def test_createEmail_message_without_patch_and_log_contains_unicode(self):
msgdict = dict(body=u'Unicode body with non-ascii (åäö).',
msgdict = dict(body=u'Unicode body with non-ascii (\u00E5\u00E4\u00F6).',
type='plain')
mn = MailNotifier('from@example.org')
m = mn.createEmail(msgdict, u'builder-näme', u'project-näme', SUCCESS)
m = mn.createEmail(msgdict, u'builder-n\u00E5me', u'project-n\u00E5me', SUCCESS)
try:
print m.as_string()
m.as_string()
except UnicodeEncodeError:
self.fail('Failed to call as_string() on email message.')

def test_createEmail_message_with_patch_and_log_contains_unicode(self):
msgdict = dict(body=u'Unicode body with non-ascii (åäö).',
msgdict = dict(body=u'Unicode body with non-ascii (\u00E5\u00E4\u00F6).',
type='plain')
patch = ['', u'åäö', '']
logs = [FakeLog(u'Unicode log with non-ascii (åäö).')]
patch = ['', u'\u00E5\u00E4\u00F6', '']
logs = [FakeLog(u'Unicode log with non-ascii (\u00E5\u00E4\u00F6).')]
mn = MailNotifier('from@example.org', addLogs=True)
m = mn.createEmail(msgdict, u'builder-näme', u'project-näme', SUCCESS,
m = mn.createEmail(msgdict, u'builder-n\u00E5me', u'project-n\u00E5me', SUCCESS,
patch, logs)
try:
m.as_string()
Expand Down

0 comments on commit 7cc0ceb

Please sign in to comment.