forked from DataDog/go-python3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarning_test.go
More file actions
34 lines (23 loc) · 745 Bytes
/
Copy pathwarning_test.go
File metadata and controls
34 lines (23 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package python3
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestWarnEx(t *testing.T) {
Py_Initialize()
assert.Zero(t, PyErr_WarnEx(PyExc_RuntimeWarning, "test warning", 3))
}
func TestWarnExplicitObject(t *testing.T) {
Py_Initialize()
message := PyUnicode_FromString("test warning")
defer message.DecRef()
filename := PyUnicode_FromString("test.py")
defer filename.DecRef()
module := PyUnicode_FromString("test_module")
defer module.DecRef()
assert.Zero(t, PyErr_WarnExplicitObject(PyExc_RuntimeError, message, filename, 4, module, nil))
}
func TestWarnExplicit(t *testing.T) {
Py_Initialize()
assert.Zero(t, PyErr_WarnExplicit(PyExc_RuntimeError, "test warning", "test.py", 4, "test_module", nil))
}