File: test_path_get.py

package info (click to toggle)
dpath-python 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 256 kB
  • sloc: python: 1,671; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 429 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import dpath.segments
import dpath.exceptions


def test_path_get_list_of_dicts():
    tdict = {
        "a": {
            "b": [
                {0: 0},
                {0: 1},
                {0: 2},
            ],
        },
    }
    segments = ['a', 'b', 0, 0]

    res = dpath.segments.view(tdict, segments)
    assert isinstance(res['a']['b'], list)
    assert len(res['a']['b']) == 1
    assert res['a']['b'][0][0] == 0