Exemple #1
0
def test_yaml():
    # cat = namedtupled.yaml(path='cat.yaml')
    # assert cat.says == 'meow'
    data = """
    binks:
      says: meow
    """
    cat = namedtupled.yaml(data)
    assert cat.binks.says == 'meow'
Exemple #2
0
def test_namedtupled_yaml_array_data(data=yaml_array):
    t = namedtupled.yaml(data)
    assert t[0].tito.tata == 'tutu'
    assert t[0].tito.frobnicator == ['this', 'is', 'not', 'a', 'mapping']
    assert t[0].foo == 'bar'
    assert t[0].baz.qux == 'quux'
    assert t[0].alist[0].a == 'A'
    assert t[0].alist[1].two == '2'
    assert t[0].baz != {'qux': 'quux'}
    assert t[0].alist[0] != {'one': '1', 'a': 'A'}
Exemple #3
0
def test_nametupled_yaml_error(data=yaml_object, path='foo.yaml'):
    with pytest.raises(ValueError) as e:
        namedtupled.yaml(data=data, path=path)
    'expected one source' in str(e)