From b8436b026a90291ba26afa4f7a2700720b03339f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 4 May 2011 05:41:33 +0000 Subject: remove python test cases --- sys/lib/python/test/test_code.py | 102 --------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 sys/lib/python/test/test_code.py (limited to 'sys/lib/python/test/test_code.py') diff --git a/sys/lib/python/test/test_code.py b/sys/lib/python/test/test_code.py deleted file mode 100644 index 4e6863856..000000000 --- a/sys/lib/python/test/test_code.py +++ /dev/null @@ -1,102 +0,0 @@ -"""This module includes tests of the code object representation. - ->>> def f(x): -... def g(y): -... return x + y -... return g -... - ->>> dump(f.func_code) -name: f -argcount: 1 -names: () -varnames: ('x', 'g') -cellvars: ('x',) -freevars: () -nlocals: 2 -flags: 3 -consts: ('None', '') - ->>> 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 -... b = x - y -... c = a * b -... return c -... ->>> 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 -... print obj.attr2 -... print obj.attr3 - ->>> 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' -... 'not a docstring' -... 53 -... 53L - ->>> dump(optimize_away.func_code) -name: optimize_away -argcount: 0 -names: () -varnames: () -cellvars: () -freevars: () -nlocals: 0 -flags: 67 -consts: ("'doc string'", 'None') - -""" - -def consts(t): - """Yield a doctest-safe sequence of object reprs.""" - for elt in t: - r = repr(elt) - if r.startswith("" % elt.co_name - else: - yield r - -def dump(co): - """Print out a text representation of a code object.""" - for attr in ["name", "argcount", "names", "varnames", "cellvars", - "freevars", "nlocals", "flags"]: - 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 - from test import test_code - run_doctest(test_code, verbose) -- cgit v1.2.3