From: <pj...@us...> - 2009-10-20 03:43:55
|
Revision: 6883 http://jython.svn.sourceforge.net/jython/?rev=6883&view=rev Author: pjenvey Date: 2009-10-20 03:43:46 +0000 (Tue, 20 Oct 2009) Log Message: ----------- identify reflected funcs as routines so they can show up in help() Modified Paths: -------------- trunk/jython/Lib/inspect.py Added Paths: ----------- trunk/jython/Lib/test/test_inspect_jy.py Modified: trunk/jython/Lib/inspect.py =================================================================== --- trunk/jython/Lib/inspect.py 2009-10-20 03:28:30 UTC (rev 6882) +++ trunk/jython/Lib/inspect.py 2009-10-20 03:43:46 UTC (rev 6883) @@ -30,6 +30,7 @@ import sys, os, types, string, re, dis, imp, tokenize, linecache from operator import attrgetter +ReflectedFunctionType = type(os.listdir) # ----------------------------------------------------------- type-checking def ismodule(object): @@ -196,7 +197,8 @@ return (isbuiltin(object) or isfunction(object) or ismethod(object) - or ismethoddescriptor(object)) + or ismethoddescriptor(object) + or isinstance(object, ReflectedFunctionType)) def getmembers(object, predicate=None): """Return all members of an object as (name, value) pairs sorted by name. Added: trunk/jython/Lib/test/test_inspect_jy.py =================================================================== --- trunk/jython/Lib/test/test_inspect_jy.py (rev 0) +++ trunk/jython/Lib/test/test_inspect_jy.py 2009-10-20 03:43:46 UTC (rev 6883) @@ -0,0 +1,21 @@ +"""Misc inspect tests + +Made for Jython. +""" +import inspect +import unittest +from java.lang import System +from test import test_support + +class InspectTestCase(unittest.TestCase): + + def test_java_routine(self): + self.assertTrue(inspect.isroutine(System.arraycopy)) + + +def test_main(): + test_support.run_unittest(InspectTestCase) + + +if __name__ == '__main__': + test_main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |