• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.source函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.util.source函数的典型用法代码示例。如果您正苦于以下问题:Python source函数的具体用法?Python source怎么用?Python source使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了source函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testModifiers3

    def testModifiers3(self):
        program = util.source('''
            sealed override def bork():
                pass
        ''')

        util.parseProgram(program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:functiondecltest.py


示例2: testModifiers1

    def testModifiers1(self):
        program = util.source('''
            static def bork():
                pass
        ''')

        util.parseProgram(program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:functiondecltest.py


示例3: testReadProperty

    def testReadProperty(self):
        program = util.source('''
            var o = TestClass.TestClass(2)
            print o.Property
        ''')

        util.runProgram('extern_read_property_test', program, ['mscorlib', 'bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:externtest.py


示例4: testCompileString

    def testCompileString(self):
        program = util.source('''
            print 'Expect 9:'
            var count = 0
            if 1<9:
                count = count + 1
            else:
                count = count + 99

            if 1>9:
                pass
            else:
                count = count + 3

            if 1>9:
                pass
            elif 9>1:
                count = count + 4

            if 9<1:
                pass
            elif 9<1:
                pass
            else:
                count = count + 1

            print count

            if count == 9:
                print 'Looks like it passed.  Woohoo!'
            else:
                print 'Oh no it failed!!' ''')

        util.runProgram('if_test',program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:34,代码来源:iftest.py


示例5: testRandomCharTests

    def testRandomCharTests(self):
        # TODO:when this is all implemented this test should reflect that
        from tests import util

        program = util.source(
            """
            #var z as char='N' #char
            var y = '9' #string
            var x = "nine" #also string
            var z = y[0]
            
            #print "z = 'N':"
            #print z
            print "x = 'nine' starts with 'n':"
            print x
            print x[0]
            #print "see 'n' become 'N':"
            x[0]=z
            print x
            print "see three '9's:"
            print y
            print y[0]
            print y as char
        """
        )

        self.assertRaises(error.TypeError, lambda: util.runProgram("test_random_char_tests", program))
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:27,代码来源:literaltest.py


示例6: testParseNoExceptOrFinally

    def testParseNoExceptOrFinally(self):
        program = util.source('''
            try:
                pass
        ''')

        self.assertRaises(error.SyntaxError, lambda: util.parseProgram(program))
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:trytest.py


示例7: testEmitCode

    def testEmitCode(self):
        program = util.source('''\
            var x as int
            print x
        ''')

        util.runProgram('variable_test', program, ['mscorlib'])
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:variabletest.py


示例8: testCodeGen

    def testCodeGen(self):
        program = util.source('''
            def foo(x as int, y as int):
                print x * y
        ''')

        util.buildProgram('functiondecl_codegen_test', program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:functiondecltest.py


示例9: testEmptyInterface

    def testEmptyInterface(self):
        program = util.source('''
            interface Foo:
                pass
        ''')

        util.buildProgram('interface_empty_test', program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:interfacetest.py


示例10: testReadAttribute

    def testReadAttribute(self):
        program = util.source('''
            var o = TestClass.TestClass()
            print o.x
        ''')

        util.runProgram('extern_read_attr_test', program, ['bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:externtest.py


示例11: testReturnType

    def testReturnType(self):
        program = util.source('''
            def foo() as System.Object:
                pass
        ''')

        util.buildProgram('namespace_return_test', program, ['mscorlib'])
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:namespacetest.py


示例12: testTypes

 def testTypes(self):
     util.runProgram('print_types', util.source('''
         print (27 as int)
         print (27 as float)
         print (27 as System.Double)
         print (true as boolean)
     '''), ['mscorlib'])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:printtest.py


示例13: testValue

    def testValue(self):
        program = util.source('''
            var t as System.Reflection.Assembly
            print t
        ''')

        util.buildProgram('namespace_variable_test', program, ['mscorlib'])
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:namespacetest.py


示例14: testCodeGen

    def testCodeGen(self):
        program = util.source('''
            var a = -9
            var b = -3.1415926535897931
            var c = +9
            var d = -c
            var e = ~0
            var f = ~(~1)

            print a
            print b
            print c
            print d
            print e
            print f

            var t1 = true
            var f1 = false
            var f2 = not t1
            var t2 = not f2
            var t3 = not f1

            print ''
            print 'Expect True, False, False, True, True'
            print t1
            print f1
            print f2
            print t2
            print t3
        ''')

        util.runProgram('unary_codegen_test', program)
开发者ID:andyfriesen,项目名称:nine,代码行数:32,代码来源:unarytest.py


示例15: testIndentation

    def testIndentation(self):
        result = lex(util.source('''
            0
                4

                4
                    8

            0
              2
                  6'''))

        EOS = END_OF_STATEMENT
        BB = BEGIN_BLOCK
        EB = END_BLOCK
        EOF = END_OF_FILE

        expected = [
            '0', EOS,  BB, '4',  EOS, '4', EOS,
             BB, '8', EOS,  EB,   EB, EOS, '0', EOS,
             BB, '2', EOS,  BB,  '6', EOS,  EB,  EB, EOS, EOF
        ]

        self.failUnlessEqual(len(result), len(expected))
        self.failUnlessEqual(result, expected)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:25,代码来源:lexertest.py


示例16: testParameter

    def testParameter(self):
        program = util.source('''
            def foo(c as System.Type):
                pass
        ''')

        util.buildProgram('namespace_parameter_test', program, ['mscorlib'])
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:namespacetest.py


示例17: testReturnType

    def testReturnType(self):
        program = util.source('''
            def multiply(x as int, y as int) as int:
                pass
        ''')

        util.buildProgram('functiondecl_returntype_test', program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:functiondecltest.py


示例18: testCreateType

    def testCreateType(self):
        program = util.source('''
            delegate MyDelegate(a as int) as string
            '''
        )

        util.runProgram('delegate_type_test', program, [])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:delegatetest.py


示例19: testParseEmptIface

    def testParseEmptIface(self):
        program = util.source('''
            interface Foo:
                pass
        ''')

        util.parseProgram(program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:interfacetest.py


示例20: testCallMethod

    def testCallMethod(self):
        program = util.source('''
            var o = TestClass.TestClass()
            o.Method('Hello to C# from Nine!')
        ''')

        util.runProgram('extern_method_test', program, ['bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:externtest.py



注:本文中的tests.util.source函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.test_path函数代码示例发布时间:2022-05-27
下一篇:
Python util.runProgram函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap