Ejemplo n.º 1
0
def test_module_doc_cp21360():
    from iptest.file_util import write_to_file, delete_files
    
    try:
        temp_filename_empty = "cp21360_empty.py"
        write_to_file(temp_filename_empty, "")
        import cp21360_empty
        AreEqual(cp21360_empty.__doc__, None)
    
        temp_filename = "cp21360.py"
        write_to_file(temp_filename, "x = 3.14")
        import cp21360
        AreEqual(cp21360.__doc__, None)
        AreEqual(cp21360.x, 3.14)
    
    finally:
        delete_files(temp_filename, temp_filename_empty)
Ejemplo n.º 2
0
def test_word_basic():
    '''
    http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=14166
    '''
    temp_file_name = nt.tempnam() + ".word_basic.doc"
    
    word_basic = getRCWFromProgID("Word.Basic")
    if is_snap:
        word_basic.AppShow()
    word_basic.FileNewDefault()
    word_basic.Insert("some stuff...")
    word_basic.FileSaveAs(temp_file_name)
    if is_snap:
        word_basic.AppHide()
    del word_basic
    
    Assert(file_exists(temp_file_name))
    delete_files(temp_file_name)
Ejemplo n.º 3
0
def test_write_buffer():
    from iptest.file_util import delete_files
    
    try:
        for mode in ('b', ''):
            foo = open('foo', 'w+' + mode)
            b = buffer(b'hello world', 6)
            foo.write(b)
            foo.close()
        
            foo = open('foo', 'r')
            AreEqual(foo.readlines(), ['world'])
            foo.close()
        
        foo = open('foo', 'w+')
        b = buffer(u'hello world', 6)
        foo.write(b)
        foo.close()
        
        foo = open('foo', 'r')
        AreEqual(foo.readlines(), ['world'])
        foo.close()
        
        foo = open('foo', 'w+b')
        b = buffer(u'hello world', 6)
        foo.write(b)
        foo.close()
        
        foo = open('foo', 'r')
        if is_cpython:
            AreEqual(foo.readlines(), ['l\x00o\x00 \x00w\x00o\x00r\x00l\x00d\x00'])
        else:
            AreEqual(foo.readlines(), ['world'])
        foo.close()

    finally:
        delete_files("foo")