tests/pyutils/test_print_path_list.py
raw| 1 | from graphql.pyutils import print_path_list |
| 2 | |
| 3 | |
| 4 | def describe_print_path_as_list(): |
| 5 | def without_key(): |
| 6 | assert print_path_list([]) == "" |
| 7 | |
| 8 | def with_one_key(): |
| 9 | assert print_path_list(["one"]) == ".one" |
| 10 | assert print_path_list([1]) == "[1]" |
| 11 | |
| 12 | def with_three_keys(): |
| 13 | assert print_path_list([0, "one", 2]) == "[0].one[2]" |
| 14 | assert print_path_list(["one", 2, "three"]) == ".one[2].three" |