Debian Codegraph @

pypy/module/cpyext/test/test_pystrhex.py

raw symbols SCIP
1 from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
2
3 class AppTestPyStrHex(AppTestCpythonExtensionBase):
4 def test_simple(self):
5 module = self.import_extension('strhex', [
6 ("new", "METH_NOARGS",
7 """
8 static char a[] = { (char)255, 0, 65 };
9 PyObject *o1 = _Py_strhex(a, 3);
10 PyObject *o2 = _Py_strhex_bytes(a, 3);
11 return PyTuple_Pack(2, o1, o2);
12 """)],
13 prologue="""
14 #include <pystrhex.h>
15 """)
16 o1, o2 = module.new()
17 assert type(o1) is str
18 assert type(o2) is bytes
19 assert o1 == u"ff0041"
20 assert o2 == b"ff0041"