/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/python/cpp11_std_function_runme.py
39 строк
990 B
William S Fulton
Final fixes and tweaks to std::function wrappers
03 май 2026, 21:00
03 май 2026, 21:00
23a3f1d
Код
Авторство
О чём код?
import cpp11_std_function fn = cpp11_std_function.pass_checker(420) # invoke functor via call method result = fn.call(420, "Petka") if not result: raise RuntimeError("Petka 420 should be true") result = fn.call(419, "Chapai") if result: raise RuntimeError("Chapai 419 should be false") # call wrapper result = cpp11_std_function.call_function(fn, 420, "Petka") if not result: raise RuntimeError("Petka 420 should be true") result = cpp11_std_function.call_function(fn, 419, "Chapai") if result: raise RuntimeError("Petka 419 should be false") # NULL handling passed = False try: cpp11_std_function.call_function(None, 420, "Petka") except TypeError: passed = True if not passed: raise RuntimeError("call_function accepted invalid argument") # Invalid argument passed = False try: cpp11_std_function.call_function("invalid", 420, "Petka") except TypeError: passed = True if not passed: raise RuntimeError("call_function accepted invalid argument")