2 Star 0 Fork 0

mirrors_DataDog / go-python3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
exceptions_test.go 732 Bytes
一键复制 编辑 原始数据 按行查看 历史
Rémi Calixte 提交于 2019-01-18 14:50 . Unit tests (#11)
package python3
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestExceptionNew(t *testing.T) {
Py_Initialize()
exc := PyErr_NewException("test_module.TestException", nil, nil)
assert.NotNil(t, exc)
defer exc.DecRef()
}
func TestExceptionNewDoc(t *testing.T) {
Py_Initialize()
exc := PyErr_NewExceptionWithDoc("test_module.TestException", "docstring", nil, nil)
assert.NotNil(t, exc)
defer exc.DecRef()
}
func TestExceptionContext(t *testing.T) {
Py_Initialize()
exc := PyErr_NewException("test_module.TestException", nil, nil)
assert.NotNil(t, exc)
defer exc.DecRef()
PyException_SetContext(exc, PyExc_BrokenPipeError)
assert.Equal(t, PyExc_BrokenPipeError, PyException_GetContext(exc))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_DataDog/go-python3.git
git@gitee.com:mirrors_DataDog/go-python3.git
mirrors_DataDog
go-python3
go-python3
master

搜索帮助