<s> import doctest <EOL> import inspect <EOL> import os . path <EOL> import cytoolz <EOL> def raises ( err , lamda ) : <EOL> try : <EOL> lamda ( ) <EOL> return False <EOL> except err : <EOL> return True <EOL> no_default = '<STR_LIT>' <EOL> def include_dirs ( ) : <EOL> """<STR_LIT>""" <EOL> return os . path . split ( cytoolz . __path__ [ <NUM_LIT:0> ] ) <EOL> def _from_module ( module , object ) : <EOL> """<STR_LIT>""" <EOL> if module is None : <EOL> return True <EOL> elif inspect . getmodule ( object ) is not None : <EOL> return module is inspect . getmodule ( object ) <EOL> elif inspect . isfunction ( object ) : <EOL> return module . __dict__ is object . func_globals <EOL> elif inspect . isclass ( object ) : <EOL> return module . __name__ == object . __module__ <EOL> elif hasattr ( object , '<STR_LIT>' ) : <EOL> return module . __name__ == object . __module__ <EOL> elif isinstance ( object , property ) : <EOL> return True <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> def fix_module_doctest ( module ) : <EOL> """<STR_LIT>""" <EOL> module . __test__ = { } <EOL> for name in dir ( module ) : <EOL> value = getattr ( module , name ) <EOL> if ( inspect . isbuiltin ( value ) and isinstance ( value . __doc__ , str ) and <EOL> _from_module ( module , value ) ) : <EOL> module . __test__ [ name ] = value . __doc__ <EOL> def module_doctest ( m , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> fix_module_doctest ( m ) <EOL> return doctest . testmod ( m , * args , ** kwargs ) . failed == <NUM_LIT:0> </s>
