Hi list
Trying to acquire good coding habits, I started a new personal module, now 1. I wonder if there is an IMP_WARN macro that would output some message under some condition, just like IMP_USAGE_CHECK() does but without aborting the application 2. I would like to write test case functions a. Is there a doc on how to write good test functions ? b. Where can I find the IMP.test.TestCase class, so that I can dissect it at will ?
--Ben
On 1/13/11 9:17 AM, Benjamin SCHWARZ wrote: > 1. I wonder if there is an IMP_WARN macro that would output some message > under some condition, just like IMP_USAGE_CHECK() does but without > aborting the application
Yes; it is called IMP_WARN. ;) See kernel/include/log.h.
> 2. I would like to write test case functions > a. Is there a doc on how to write good test functions ?
There are many guides to writing good unit tests. One good introduction is in Dive Into Python at http://diveintopython.org/unit_testing/index.html
> b. Where can I find the IMP.test.TestCase class, so that I can dissect > it at will ?
kernel/pyext/src/test/__init__.py
Ben
On Jan 13, 2011, at 9:25 AM, Ben Webb wrote:
> On 1/13/11 9:17 AM, Benjamin SCHWARZ wrote: >> 1. I wonder if there is an IMP_WARN macro that would output some message >> under some condition, just like IMP_USAGE_CHECK() does but without >> aborting the application > > Yes; it is called IMP_WARN. ;) See kernel/include/log.h. IMP_WARN doesn't have the conditional aspect of IMP_USAGE_CHECK. The reason for this was that warnings never get disappeared on compilation like IMP_LOG calls (which are elided in fast mode), so there is no cost to using a normal if statement.
There are some issues with the current approach as it makes it hard to hide all the charmm warnings created by PDB readings. But solving them requires some deeper thought.
On 1/13/11 9:33 AM, Daniel Russel wrote: > IMP_WARN doesn't have the conditional aspect of IMP_USAGE_CHECK.
Well yes, this is true. Apologies if this was not clear.
> There are some issues with the current approach as it makes it hard > to hide all the charmm warnings created by PDB readings.
Those warnings will go away anyway with the next update of the CHARMM support.
Ben