def test_child_watch_all_kwargs(self): cb = lambda pid, status: None pid = object() res = GLib._child_watch_add_get_args(priority=GLib.PRIORITY_HIGH, pid=pid, function=cb, data=12345) self.assertEqual(len(res), 4) self.assertEqual(res[0], GLib.PRIORITY_HIGH) self.assertEqual(res[1], pid) self.assertEqual(res[2], cb) self.assertSequenceEqual(res[3], [12345])
def test_deprecated_child_watch_no_data(self): cb = lambda pid, status: None pid = object() with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') res = GLib._child_watch_add_get_args(pid, cb) self.assertTrue(issubclass(w[0].category, PyGIDeprecationWarning)) self.assertEqual(len(res), 4) self.assertEqual(res[0], GLib.PRIORITY_DEFAULT) self.assertEqual(res[1], pid) self.assertTrue(callable(cb)) self.assertSequenceEqual(res[3], [])
def test_deprecated_child_watch_data_priority_kwargs(self): cb = lambda pid, status: None pid = object() with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') res = GLib._child_watch_add_get_args(pid, cb, priority=GLib.PRIORITY_HIGH, data=12345) self.assertTrue(issubclass(w[0].category, PyGIDeprecationWarning)) self.assertEqual(len(res), 4) self.assertEqual(res[0], GLib.PRIORITY_HIGH) self.assertEqual(res[1], pid) self.assertEqual(res[2], cb) self.assertSequenceEqual(res[3], [12345])
def test_deprecated_child_watch_no_data(self): cb = lambda pid, status: None pid = object() with warnings.catch_warnings(record=True) as w: warnings.simplefilter('always') res = GLib._child_watch_add_get_args(pid, cb) self.assertTrue(issubclass(w[0].category, PyGIDeprecationWarning)) self.assertEqual(len(res), 4) self.assertEqual(res[0], GLib.PRIORITY_DEFAULT) self.assertEqual(res[1], pid) self.assertTrue(callable(cb)) self.assertSequenceEqual(res[3], [])