def test_infolist(): """Test infolist functions.""" hook_infolist = weechat.hook_infolist('infolist_test_script', 'description', '', '', 'infolist_cb', '') check(weechat.infolist_get('infolist_does_not_exist', '', '') == '') ptr_infolist = weechat.infolist_get('infolist_test_script', '', '') check(ptr_infolist != '') check(weechat.infolist_next(ptr_infolist) == 1) check(weechat.infolist_integer(ptr_infolist, 'integer') == 123) check(weechat.infolist_string(ptr_infolist, 'string') == 'test string') check(weechat.infolist_pointer(ptr_infolist, 'pointer') == '0xabcdef') check(weechat.infolist_time(ptr_infolist, 'time') == 1231231230) check(weechat.infolist_fields(ptr_infolist) == 'i:integer,s:string,p:pointer,t:time') check(weechat.infolist_next(ptr_infolist) == 0) weechat.infolist_free(ptr_infolist) weechat.unhook(hook_infolist)