Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 2fe96174012fea2d88f752857a5bea1d > files > 86

python-mpi4py-0.6.0-4mdv2008.1.i586.rpm

import types
import unittest
from mpi4py import MPI


def getdoc(mc, docstrings):
    name = getattr(mc, '__name__', '<no-name>')
    doc = getattr(mc, '__doc__', None)
    docstrings[name] = doc
    for k, v in vars(mc).items():
        if type(v) is types.FunctionType:
            getdoc(v, docstrings)
        elif isinstance(v, types.TypeType) or type(v) is types.ClassType:
            getdoc(v, docstrings)

class TestDoc(unittest.TestCase):

    def testDoc(self):
        docs = { }
        getdoc(MPI, docs)
        for k in docs:
            if not k.endswith('__'):
                doc = docs[k]
                self.assertTrue(doc.strip())


if __name__ == '__main__':
    try:
        unittest.main()
    except SystemExit:
        pass