示例#1
0
 def test_pythontypes(self):
     # check all types defined in Python/
     h = self.header
     vh = self.vheader
     size = self.calcsize
     check = self.check_sizeof
     # _ast.AST
     if not test.test_support.due_to_ironpython_bug(
             "http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=21088"
     ):
         import _ast
         check(_ast.AST(), size(h + ''))
     # imp.NullImporter
     import imp
     check(imp.NullImporter(self.file.name), size(h + ''))
     try:
         raise TypeError
     except TypeError:
         tb = sys.exc_info()[2]
         # traceback
         if tb != None:
             check(tb, size(h + '2P2i'))
     # symtable entry
     # XXX
     # sys.flags
     check(sys.flags, size(vh) + self.P * len(sys.flags))
示例#2
0
 def test_pythontypes(self):
     # check all types defined in Python/
     size = test.test_support.calcobjsize
     vsize = test.test_support.calcvobjsize
     check = self.check_sizeof
     # _ast.AST
     import _ast
     check(_ast.AST(), size(''))
     # imp.NullImporter
     import imp
     f = open(test.test_support.TESTFN, 'wb')
     try:
         check(imp.NullImporter(f.name), size(''))
     finally:
         f.close()
         test.test_support.unlink(test.test_support.TESTFN)
     try:
         raise TypeError
     except TypeError:
         tb = sys.exc_info()[2]
         # traceback
         if tb != None:
             check(tb, size('2P2i'))
     # symtable entry
     # XXX
     # sys.flags
     check(sys.flags, vsize('') + self.P * len(sys.flags))
示例#3
0
 def test_abstract_ast_types(self):
     ast = self.ast
     ast.expr()
     ast.AST()
     class X(ast.AST):
         pass
     X()
     class Y(ast.expr):
         pass
     Y()
     exc = raises(TypeError, ast.AST, 2)
     assert exc.value.args[0] == "_ast.AST constructor takes 0 positional arguments"
示例#4
0
 def test_pythontypes(self):
     size = test.support.calcobjsize
     vsize = test.support.calcvobjsize
     check = self.check_sizeof
     import _ast
     check(_ast.AST(), size('P'))
     try:
         raise TypeError
     except TypeError:
         tb = sys.exc_info()[2]
         if tb is not None:
             check(tb, size('2P2i'))
     check(sys.flags, vsize('') + self.P * len(sys.flags))
示例#5
0
 def test_pythontypes(self):
     # check all types defined in Python/
     size = test.support.calcobjsize
     vsize = test.support.calcvobjsize
     check = self.check_sizeof
     # _ast.AST
     import _ast
     check(_ast.AST(), size('P'))
     try:
         raise TypeError
     except TypeError:
         tb = sys.exc_info()[2]
         # traceback
         if tb is not None:
             check(tb, size('2P2i'))
     # symtable entry
     # XXX
     # sys.flags
     check(sys.flags, vsize('') + self.P * len(sys.flags))
示例#6
0
 def test_pythontypes(self):
     # check all types defined in Python/
     h = self.header
     vh = self.vheader
     size = self.calcsize
     check = self.check_sizeof
     # _ast.AST
     import _ast
     check(_ast.AST(), size(h + 'P'))
     try:
         raise TypeError
     except TypeError:
         tb = sys.exc_info()[2]
         # traceback
         if tb != None:
             check(tb, size(h + '2P2i'))
     # symtable entry
     # XXX
     # sys.flags
     check(sys.flags, size(vh) + self.P * len(sys.flags))