From 0872782255fdbaeda64311a298664597e59ba94f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 8 May 2013 08:37:13 +0100 Subject: utf8 test: pass when used with dbus 1.6.10, 1.7.2 We used to reject noncharacters, but now we accept them. --- test/test-standalone.py | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/test/test-standalone.py b/test/test-standalone.py index 584ba4f..459a41d 100755 --- a/test/test-standalone.py +++ b/test/test-standalone.py @@ -438,6 +438,28 @@ class TestMessageMarshalling(unittest.TestCase): for bad in [ uni(0xD800), utf8(0xed, 0xa0, 0x80), + ]: + s = SignalMessage('/', 'foo.bar', 'baz') + try: + s.append(bad, signature='s') + except UnicodeError: + pass + else: + raise AssertionError('Appending %r should fail' % bad) + for good in [ + uni(0xfdcf), + uni(0xfdf0), + uni(0xfeff), + uni(0x0001feff), + uni(0x00020000), + uni(0x0007feff), + uni(0x00080000), + uni(0x0010feff), + ]: + s = SignalMessage('/', 'foo.bar', 'baz') + s.append(good, signature='s') + s.append(good.encode('utf-8'), signature='s') + for noncharacter in [ uni(0xFDD0), utf8(0xef, 0xb7, 0x90), uni(0xFDD7), @@ -463,24 +485,11 @@ class TestMessageMarshalling(unittest.TestCase): ]: s = SignalMessage('/', 'foo.bar', 'baz') try: - s.append(bad, signature='s') + s.append(noncharacter, signature='s') except UnicodeError: - pass + pass # libdbus < 1.6.10 disallows noncharacters else: - raise AssertionError('Appending %r should fail' % bad) - for good in [ - uni(0xfdcf), - uni(0xfdf0), - uni(0xfeff), - uni(0x0001feff), - uni(0x00020000), - uni(0x0007feff), - uni(0x00080000), - uni(0x0010feff), - ]: - s = SignalMessage('/', 'foo.bar', 'baz') - s.append(good, signature='s') - s.append(good.encode('utf-8'), signature='s') + pass # libdbus >= 1.6.10 allows noncharacters class TestMatching(unittest.TestCase): def setUp(self): -- cgit v1.2.1