Ejemplo n.º 1
0
def test_as_list_converts_to_list_of_values(example_path, empty_context):
    a = as_list(example_path['%i'].bar['%j'])
    result = a._convert(empty_context)
    assert isinstance(result, list)
    assert sorted(result) == sorted([sentinel.foobarbaz,
                                     sentinel.moobarbaz,
                                     sentinel.foobarbang])
Ejemplo n.º 2
0
def test_as_list_converts_to_empty_list_when_less_than_one_wildcard_left_free(example_path, example_wildcarded_context):
    a = as_list(example_path['%i'].bar.baz)
    res = a._convert(example_wildcarded_context)
    assert res == []
Ejemplo n.º 3
0
def test_as_list_with_relative_path_converts_to_list_of_values(example_context):
    a = as_list(up(2)["%i"].bar["%j"])
    result = a._convert(example_context)
    assert isinstance(result, list)
    assert sorted(result) == sorted([sentinel.foobarbaz, sentinel.moobarbaz, sentinel.foobarbang])