示例#1
0
文件: test_GDL.py 项目: zj0324/gdl
def test_script():
    '''Call a simple script that writes a short file'''

    fname = os.tmpnam()
    scriptname = os.tmpnam()
    arg = 'Hello, world!'
    code = '''openw, 5, '{0}'
    printf, 5, '{1}'
    close, 5
    '''
    with GDLFile(code.format(fname, arg)) as script:
        GDL.script(script)
        ret = open(fname).read().strip()
        os.unlink(fname)
        assert arg == ret
示例#2
0
文件: test_GDL.py 项目: cenit/GDL
def test_script():
    '''Call a simple script that writes a short file'''
    
    fname = os.tmpnam()
    scriptname = os.tmpnam()
    arg = 'Hello, world!'
    code = '''openw, 5, '{0}'
    printf, 5, '{1}'
    close, 5
    '''
    with GDLFile(code.format(fname, arg)) as script:
        GDL.script(script)
        ret = open(fname).read().strip()
        os.unlink(fname)
        assert arg == ret
示例#3
0
文件: test-GDL.py 项目: pjb7687/gdl
def test_script():
    '''Call a simple script that writes a short file'''

    with warnings.catch_warnings():
        warnings.simplefilter("ignore")
        fname = tempfile.mkstemp()[1]
        scriptname = tempfile.mkstemp()[1]
    arg = 'Hello, world!'
    code = '''openw, 5, '{0}'
    printf, 5, '{1}'
    close, 5
    '''
    with GDLFile(code.format(fname, arg)) as script:
        GDL.script(script)
        ret = open(fname).read().strip()
        os.unlink(fname)
        assert arg == ret