def test_signal_query(): obj = GObject.GObject() res = GObject.signal_query("notify", obj) assert res.signal_name == "notify" assert res.itype == obj.__gtype__ res = GObject.signal_query("foobar", obj) assert res is None
def test_signal_query(self): my_signal_id, = GObject.signal_list_ids(C) # Form is: (id, name, gtype, arg_count, return_type, (arg_type1, ...)) my_signal_expected_query_result = [my_signal_id, 'my-signal', C.__gtype__, 1, GObject.TYPE_NONE, (GObject.TYPE_INT,)] # signal_query(name, type) self.assertEqual(list(GObject.signal_query('my-signal', C)), my_signal_expected_query_result) # signal_query(signal_id) self.assertEqual(list(GObject.signal_query(my_signal_id)), my_signal_expected_query_result) # invalid query returns None instead of raising self.assertEqual(GObject.signal_query(0), None) self.assertEqual(GObject.signal_query('NOT_A_SIGNAL', C), None)
def test_signal_query(self): my_signal_id, = GObject.signal_list_ids(C) # Form is: (id, name, gtype, arg_count, return_type, (arg_type1, ...)) my_signal_expected_query_result = [ my_signal_id, 'my-signal', C.__gtype__, 1, GObject.TYPE_NONE, (GObject.TYPE_INT, ) ] # signal_query(name, type) self.assertEqual(list(GObject.signal_query('my-signal', C)), my_signal_expected_query_result) # signal_query(signal_id) self.assertEqual(list(GObject.signal_query(my_signal_id)), my_signal_expected_query_result) # invalid query returns None instead of raising self.assertEqual(GObject.signal_query(0), None) self.assertEqual(GObject.signal_query('NOT_A_SIGNAL', C), None)
def _get_signal_properties(itype): queries = (GObject.signal_query(sig_id) for sig_id in _get_signal_ids(itype)) return { query.signal_name: query.param_types for query in queries }