def g_assert(expr): if not expr: caller_frame = inspect.stack()[1] caller_file = caller_frame[1] caller_line = caller_frame[2] caller_func = caller_frame[3] GLib.assertion_message("", caller_file, caller_line, caller_func, str(expr))
def g_assert_cmpstr(n1, cmp, n2): ops = { "==" : operator.eq } op = ops[cmp] if not op(n1, n2): caller_frame = inspect.stack()[1] caller_file = caller_frame[1] caller_line = caller_frame[2] caller_func = caller_frame[3] expr = str(n1) + " " + str(cmp) + " " + str(n2) GLib.assertion_message("", caller_file, caller_line, caller_func, str(expr))
def g_assert_cmpstr(n1, cmp, n2): ops = {"==": operator.eq} op = ops[cmp] if not op(n1, n2): caller_frame = inspect.stack()[1] caller_file = caller_frame[1] caller_line = caller_frame[2] caller_func = caller_frame[3] expr = str(n1) + " " + str(cmp) + " " + str(n2) GLib.assertion_message("", caller_file, caller_line, caller_func, str(expr))