Пример #1
0
def test_as_tuple_converts_to_tuple_of_values(example_path, empty_context):
    a = as_tuple(example_path['%i'].bar['%j'])
    result = a._convert(empty_context)
    assert isinstance(result, tuple)
    assert sorted(result) == sorted([sentinel.foobarbaz,
                                     sentinel.moobarbaz,
                                     sentinel.foobarbang])
Пример #2
0
def test_as_tuple_converts_to_empty_tuple_when_less_than_one_wildcard_left_free(example_path, example_wildcarded_context):
    a = as_tuple(example_path['%i'].bar.baz)
    res = a._convert(example_wildcarded_context)
    assert res == tuple()
Пример #3
0
def test_as_tuple_with_relative_path_converts_to_tuple_of_values(example_context):
    a = as_tuple(up(2)["%i"].bar["%j"])
    result = a._convert(example_context)
    assert isinstance(result, tuple)
    assert sorted(result) == sorted([sentinel.foobarbaz, sentinel.moobarbaz, sentinel.foobarbang])