コード例 #1
0
def test_YAML():        
    txt = """a: 1\nb: 2\n---\n ddd"""
    f = TempfolderFile("temp.txt").save_text(txt)
    assert YAML(txt).content == YAML(f.filename).content
    assert YAML(txt).content == [{'a': 1, 'b': 2}, 'ddd']
    f.remove()
コード例 #2
0
def test_File():
    # NOTE: works unless last line is \n 
    testline = """123\n\n456"""
    f = TempfolderFile("temp.txt").save_text(testline)    
    assert testline == f.read_text()
    f.remove()