diff options
Diffstat (limited to 'Lib/test/test_code.py')
-rw-r--r-- | Lib/test/test_code.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py index b69223d..4a88e60 100644 --- a/Lib/test/test_code.py +++ b/Lib/test/test_code.py @@ -80,6 +80,9 @@ consts: ("'doc string'", 'None') """ +import unittest +import _testcapi + def consts(t): """Yield a doctest-safe sequence of object reprs.""" for elt in t: @@ -96,10 +99,21 @@ def dump(co): print "%s: %s" % (attr, getattr(co, "co_" + attr)) print "consts:", tuple(consts(co.co_consts)) + +class CodeTest(unittest.TestCase): + + def test_newempty(self): + co = _testcapi.code_newempty("filename", "funcname", 15) + self.assertEquals(co.co_filename, "filename") + self.assertEquals(co.co_name, "funcname") + self.assertEquals(co.co_firstlineno, 15) + + def test_main(verbose=None): - from test.test_support import run_doctest + from test.test_support import run_doctest, run_unittest from test import test_code run_doctest(test_code, verbose) + run_unittest(CodeTest) if __name__ == '__main__': |