[pypy-commit] pypy cpyext-fast-typecheck: (anto, matti): add a passing test

antocuni pypy.commits at gmail.com
Tue Mar 20 10:38:54 EDT 2018


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: cpyext-fast-typecheck
Changeset: r94030:c05e38122aa5
Date: 2018-03-20 15:09 +0100
http://bitbucket.org/pypy/pypy/changeset/c05e38122aa5/

Log:	(anto, matti): add a passing test

diff --git a/pypy/module/cpyext/test/test_sliceobject.py b/pypy/module/cpyext/test/test_sliceobject.py
--- a/pypy/module/cpyext/test/test_sliceobject.py
+++ b/pypy/module/cpyext/test/test_sliceobject.py
@@ -79,3 +79,14 @@
              """),
             ])
         assert module.get_ellipsis() is Ellipsis
+
+    def test_typecheck(self):
+        module = self.import_extension('foo', [
+            ("check", "METH_O",
+             """
+                 PySliceObject *slice = (PySliceObject *)args;
+                 return PyLong_FromLong(PySlice_Check(slice));
+             """),
+            ])
+        s = slice(10, 20, 30)
+        assert module.check(s)


More information about the pypy-commit mailing list