doctest + swig example

L

Leo

Could someone please spare a .i file with an example doctest that
works? I tried as follows and it fails:

1) I have an osi.i file that generates osi.py and _osi.so. At the very
end I added:
....
%pythoncode %{
def _test():
import doctest
doctest.testfile('testOsi.txt')

if __name__ == "__main__":
_test()
%}
-----------------------

2) I have a testOsi.txt file, whose contents are taken from the output
that works on the terminal, plus some docstring stuff:
....Coin0001I At line 15 NAME STEIN15 ...
Coin0008I STEIN15 read with 0 errors
0
....
------------------------

but the result I get is:
**********************************************************************
File "testOsi.txt", line 15, in testOsi.txt
Failed example:
cbc.readMps('stein15.mps') # doctest: +ELLIPSIS,
+NORMALIZE_WHITESPACE
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.4/doctest.py", line 1243, in __run
compileflags, 1) in test.globs
File "<doctest testOsi.txt[2]>", line 1, in ?
cbc.readMps('stein15.mps') # doctest: +ELLIPSIS,
+NORMALIZE_WHITESPACE
File "/home/leolopes/research/poams/code/swimpy/osi.py", line
144, in readMps
def readMps(*args): return
_osi.OsiCbcSolverInterface_readMps(*args)
NotImplementedError: No matching function for overloaded
'OsiCbcSolverInterface_readMps'
**********************************************************************

Thanks!
Leo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,113
Latest member
KetoBurn
Top