Remove python3 specific runme3.py test files
This file can be run using Python 2, the test is just ignored
This commit is contained in:
parent
d4ffa46f41
commit
2af35cb4ff
1 changed files with 0 additions and 0 deletions
35
Examples/test-suite/python/python_abstractbase_runme.py
Normal file
35
Examples/test-suite/python/python_abstractbase_runme.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import sys
|
||||
|
||||
# collections.abc requires Python 3.3+
|
||||
if sys.version_info[0:2] < (3, 3):
|
||||
exit(0)
|
||||
|
||||
from python_abstractbase import *
|
||||
import collections.abc
|
||||
|
||||
# This is expected to fail with -builtin option
|
||||
# Builtin types can't inherit from pure-python abstract bases
|
||||
if is_python_builtin():
|
||||
exit(0)
|
||||
|
||||
# Python abc is only turned on when -py3 option is passed to SWIG
|
||||
if not is_swig_py3:
|
||||
exit(0)
|
||||
|
||||
def check_issubclass(derived, base):
|
||||
if not issubclass(derived, base):
|
||||
raise RuntimeError("{} is not a subclass of {}".format(derived, base))
|
||||
|
||||
check_issubclass(Mapii, collections.abc.MutableMapping)
|
||||
check_issubclass(Multimapii, collections.abc.MutableMapping)
|
||||
check_issubclass(IntSet, collections.abc.MutableSet)
|
||||
check_issubclass(IntMultiset, collections.abc.MutableSet)
|
||||
check_issubclass(IntVector, collections.abc.MutableSequence)
|
||||
check_issubclass(IntList, collections.abc.MutableSequence)
|
||||
|
||||
mapii = Mapii()
|
||||
multimapii = Multimapii()
|
||||
intset = IntSet()
|
||||
intmultiset = IntMultiset()
|
||||
intvector = IntVector()
|
||||
intlist = IntList()
|
||||
Loading…
Add table
Add a link
Reference in a new issue