Exemplo n.º 1
0
def test_save_template(tmpdir):
    """Test saving a template.

    """
    path = str(tmpdir.join('test.template.ini'))
    save_template(path, {'test': 'é'}, 'à'*100)

    conf = ConfigObj(path)
    assert 'test' in conf
    assert len(conf.initial_comment) == 2
Exemplo n.º 2
0
def test_load_template(tmpdir):
    """Test loading a template.

    """
    path = str(tmpdir.join('test.template.ini'))
    doc = 'à\nb\nc'
    save_template(path, {'test': 'é'}, doc)

    conf, docl = load_template(path)
    assert 'test' in conf
    assert docl == doc.replace('\n', ' ')