322
322
aeq(Message.guess_signature(('a',)), '(s)')
323
323
aeq(Message.guess_signature(['a']), 'as')
324
324
aeq(Message.guess_signature({'a':'b'}), 'a{ss}')
325
aeq(Message.guess_signature(types.ObjectPath('/')), 'o')
326
aeq(Message.guess_signature(types.Signature('x')), 'g')
326
328
def test_guess_signature_python_ints(self):
327
329
aeq = self.assertEqual
421
423
raise AssertionError('Appending too many things in a struct '
427
from _dbus_bindings import SignalMessage
435
return str('').join(map(chr, xs))
440
utf8(0xed, 0xa0, 0x80),
442
utf8(0xef, 0xb7, 0x90),
444
utf8(0xef, 0xb7, 0x97),
446
utf8(0xef, 0xb7, 0xaf),
448
utf8(0xef, 0xbf, 0xbe),
450
utf8(0xef, 0xbf, 0xbf),
452
utf8(0xf0, 0x9f, 0xbf, 0xbe),
454
utf8(0xf0, 0x9f, 0xbf, 0xbf),
456
utf8(0xf1, 0xbf, 0xbf, 0xbe),
458
utf8(0xf1, 0xbf, 0xbf, 0xbf),
460
utf8(0xf4, 0x8f, 0xbf, 0xbe),
462
utf8(0xf4, 0x8f, 0xbf, 0xbf),
464
s = SignalMessage('/', 'foo.bar', 'baz')
466
s.append(bad, signature='s')
470
raise AssertionError('Appending %r should fail' % bad)
481
s = SignalMessage('/', 'foo.bar', 'baz')
482
s.append(good, signature='s')
483
s.append(good.encode('utf-8'), signature='s')
425
485
class TestMatching(unittest.TestCase):
440
500
self._message.append('/', signature='o')
441
501
self.assertFalse(self._match.maybe_handle_message(self._message))
444
503
if __name__ == '__main__':
445
504
# Python 2.6 doesn't accept a `verbosity` keyword.