swig/Examples/test-suite/python/li_std_containers_overload_runme.py
William S Fulton 86cb3a9532 Python STL container method overloading fix
Fix method overloading of methods that take STL containers of different types.
Due to some error handling that was not cleared during typehecking.
2019-08-06 19:36:14 +01:00

29 lines
620 B
Python

from li_std_containers_overload import *
def check(got, expected):
if got != expected:
raise RuntimeError("Failed check. '{}' != '{}'".format(got, expected))
v = VectorX()
check(VectorOverload(v), "vector<X>")
v = VectorY()
check(VectorOverload(v), "vector<Y>")
v = VectorInt()
check(VectorOverload(v), "vector<int>")
v = VectorString()
check(VectorOverload(v), "vector<string>")
v = [X()]
check(VectorOverload(v), "vector<X>")
v = [Y()]
check(VectorOverload(v), "vector<Y>")
v = [1, 2, 3]
check(VectorOverload(v), "vector<int>")
v = ["aaa", "bbb", "ccc"]
check(VectorOverload(v), "vector<string>")