R
Runsun Pan
I intend to use the doctect heavily. For this I am thinking of
coding a class that comes with a built-in doctest functionality.
I'd like to seek for input before I start.
The idea is to have a class MyObj from where all my other
classes will subclass.
lets say:
class C(MyObj):
''' This C
(some doctest here) ---- doctest.1
'''
def func1(self):
''' This is C.func1
(some doctest here) --- doctest.2
'''
blah blah blah
return blah
Now, after the above class defintion, I can just do:
C( ).doctest( )
and it will go through doctest.1 and doctest.2 and report the
test results
What is the better way to make such a MyObj ?
The applications of this sort of built-ins are not limited to
a doctest. Similar to the built-in __doc__ that offers some sort
of documentation, a mechnism like what I am proposing can
provide "customization on the fly" feature to allow manipulations
of the doctext at run-time. For example,
C( ).toHtml( )
to convert the __doc__ to a webpage by converting it throu
reStructuredText.
--
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
Runsun Pan, PhD
(e-mail address removed)
Nat'l Center for Macromolecular Imaging
http://ncmi.bcm.tmc.edu/ncmi/
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
coding a class that comes with a built-in doctest functionality.
I'd like to seek for input before I start.
The idea is to have a class MyObj from where all my other
classes will subclass.
lets say:
class C(MyObj):
''' This C
(some doctest here) ---- doctest.1
'''
def func1(self):
''' This is C.func1
(some doctest here) --- doctest.2
'''
blah blah blah
return blah
Now, after the above class defintion, I can just do:
C( ).doctest( )
and it will go through doctest.1 and doctest.2 and report the
test results
What is the better way to make such a MyObj ?
The applications of this sort of built-ins are not limited to
a doctest. Similar to the built-in __doc__ that offers some sort
of documentation, a mechnism like what I am proposing can
provide "customization on the fly" feature to allow manipulations
of the doctext at run-time. For example,
C( ).toHtml( )
to convert the __doc__ to a webpage by converting it throu
reStructuredText.
--
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
Runsun Pan, PhD
(e-mail address removed)
Nat'l Center for Macromolecular Imaging
http://ncmi.bcm.tmc.edu/ncmi/
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~