473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

doctest + swig example

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:
....
>>import osi
cbc = osi.OsiCbcSolverInterface()
cbc.readMps('stein15.mps') # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
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.

Jul 26 '06 #1
0 1051

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Pierre Rouleau | last post by:
I have a problem writing self-testable modules using doctest when these modules have internationalized strings using gettext _('...'). - The main module of an application (say app.py) calls...
2
by: Alan G Isaac | last post by:
> python doctest.py -v Running doctest.__doc__ Trying: .remove(42) Expecting: Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: list.remove(x): x not in list ok...
2
by: Michele Simionato | last post by:
Some time ago I hacked a custom solution to run doctests on text files containing documentation. The solution involved this kind of game: tester=doctest.Tester(globs={},verbose=1)...
0
by: bearophile | last post by:
doctest module is quite useful; and I've also tried the simpler docex: http://aima.cs.berkeley.edu/python/docex.html http://aima.cs.berkeley.edu/python/docex.py (docex isn't perfect, there are...
5
by: Michele Simionato | last post by:
I am getting a strange error with this script: $ cat doctest-threads.py """ >>> import time, threading >>> def example(): .... thread.out = .... while thread.running: .... ...
1
by: David MacKay | last post by:
Hello, I'm a python-list newbie. I've got a question about doctest; perhaps a bug report. I really like doctest, but sometimes doctest gives a failure when the output looks absolutely fine to me...
0
by: Steven Bethard | last post by:
I have an optparse-like module and though I have a full unittest-style suite of tests for it, I'd also like to be able to run doctest on the documentation to make sure my examples all work. ...
0
by: Eric Mahurin | last post by:
Noob here. Just got into python a little over a week ago... One of the (unique?) things I really like about python is the concept of doctesting. But, now I want more! Here's what I'd like to...
12
by: thomas.guest | last post by:
I'm not making progress with the following and would appreciate any help. Here's an interpreted Python session. .... Traceback (most recent call last): File "<stdin>", line 1, in <module>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.