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])
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 == []
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])