Commit 6a1f9292 authored by Bradley M. Froehle's avatar Bradley M. Froehle

Add run test for type ctypedef and PyType_IsSubtype.

parent 12754a43
from cpython.type cimport PyType_IsSubtype
class mylist(list): pass
def test_issubtype(a, b):
"""
>>> test_issubtype(mylist, list)
True
>>> test_issubtype(mylist, dict)
False
>>> o = object()
>>> test_issubtype(o, list)
Traceback (most recent call last):
...
TypeError: Cannot convert object to type
"""
return PyType_IsSubtype(a, b)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment