From: <fwi...@us...> - 2008-09-03 01:01:00
|
Revision: 5285 http://jython.svn.sourceforge.net/jython/?rev=5285&view=rev Author: fwierzbicki Date: 2008-09-03 01:00:56 +0000 (Wed, 03 Sep 2008) Log Message: ----------- Removed co_names, co_consts since these are implementation details that may never get implemented, and removed flags since there are implementation differences that may never line up. Still failing on one test for varnames because I think it is possible that the order of varnames might be useful (in order declared) and Jython doesn't quite get that right. Modified Paths: -------------- trunk/jython/Lib/test/test_code.py Modified: trunk/jython/Lib/test/test_code.py =================================================================== --- trunk/jython/Lib/test/test_code.py 2008-09-03 00:25:53 UTC (rev 5284) +++ trunk/jython/Lib/test/test_code.py 2008-09-03 01:00:56 UTC (rev 5285) @@ -1,3 +1,8 @@ +#For Jython, removed co_names, co_consts since these are implementation details +# that may never get implemented, and removed flags since there are implementation +# differences that may never line up. Still failing on one test for varnames +# because I think it is possible that the order of varnames might be useful (in +# order declared) and Jython doesn't quite get that right. """This module includes tests of the code object representation. >>> def f(x): @@ -9,24 +14,18 @@ >>> dump(f.func_code) name: f argcount: 1 -names: () varnames: ('x', 'g') cellvars: ('x',) freevars: () nlocals: 2 -flags: 3 -consts: ('None', '<code object g>') >>> dump(f(4).func_code) name: g argcount: 1 -names: () varnames: ('y',) cellvars: () freevars: ('x',) nlocals: 1 -flags: 19 -consts: ('None',) >>> def h(x, y): ... a = x + y @@ -37,13 +36,10 @@ >>> dump(h.func_code) name: h argcount: 2 -names: () varnames: ('x', 'y', 'a', 'b', 'c') cellvars: () freevars: () nlocals: 5 -flags: 67 -consts: ('None',) >>> def attrs(obj): ... print obj.attr1 @@ -53,13 +49,10 @@ >>> dump(attrs.func_code) name: attrs argcount: 1 -names: ('attr1', 'attr2', 'attr3') varnames: ('obj',) cellvars: () freevars: () nlocals: 1 -flags: 67 -consts: ('None',) >>> def optimize_away(): ... 'doc string' @@ -70,13 +63,10 @@ >>> dump(optimize_away.func_code) name: optimize_away argcount: 0 -names: () varnames: () cellvars: () freevars: () nlocals: 0 -flags: 67 -consts: ("'doc string'", 'None') """ @@ -91,10 +81,9 @@ def dump(co): """Print out a text representation of a code object.""" - for attr in ["name", "argcount", "names", "varnames", "cellvars", - "freevars", "nlocals", "flags"]: + for attr in ["name", "argcount", "varnames", "cellvars", + "freevars", "nlocals"]: print "%s: %s" % (attr, getattr(co, "co_" + attr)) - print "consts:", tuple(consts(co.co_consts)) def test_main(verbose=None): from test.test_support import run_doctest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |