コード例 #1
0
    def test_append(self):
        aeq = self.assertEqual
        from _dbus_bindings import SignalMessage
        s = SignalMessage('/', 'foo.bar', 'baz')
        s.append([types.Byte(1)], signature='ay')
        aeq(s.get_signature(), 'ay')
        aeq(s.get_args_list(), [[types.Byte(1)]])

        s = SignalMessage('/', 'foo.bar', 'baz')
        s.append([], signature='ay')
        aeq(s.get_args_list(), [[]])
コード例 #2
0
 def test_append_Variant(self):
     aeq = self.assertEqual
     from _dbus_bindings import SignalMessage
     s = SignalMessage('/', 'foo.bar', 'baz')
     s.append(types.Int32(1, variant_level=0),
              types.String('a', variant_level=42),
              types.Array([types.Byte(b'a', variant_level=1),
                           types.UInt32(123, variant_level=1)],
                          signature='v'),
              signature='vvv')
     aeq(s.get_signature(), 'vvv')
     args = s.get_args_list()
     aeq(args[0].__class__, types.Int32)
     aeq(args[0].variant_level, 1)
     aeq(args[1].__class__, types.String)
     aeq(args[1].variant_level, 42)
     aeq(args[2].__class__, types.Array)
     aeq(args[2].variant_level, 1)
     aeq(args[2].signature, 'v')