@@ -11,10 +11,10 @@ def test_util_get_root():
11
11
x = {'p' : {'a' : {'t' : {'h' : 'value' }}}}
12
12
13
13
ret = dpath .util .get (x , '/p/a/t/h' )
14
- assert ( ret == 'value' )
14
+ assert ret == 'value'
15
15
16
16
ret = dpath .util .get (x , '/' )
17
- assert ( ret == x )
17
+ assert ret == x
18
18
19
19
20
20
def test_get_explicit_single ():
@@ -30,11 +30,11 @@ def test_get_explicit_single():
30
30
},
31
31
}
32
32
33
- assert ( dpath .util .get (ehash , '/a/b/c/f' ) == 2 )
34
- assert ( dpath .util .get (ehash , ['a' , 'b' , 'c' , 'f' ]) == 2 )
35
- assert ( dpath .util .get (ehash , ['a' , 'b' , 'c' , 'f' ], default = 5 ) == 2 )
36
- assert ( dpath .util .get (ehash , ['does' , 'not' , 'exist' ], default = None ) is None )
37
- assert ( dpath .util .get (ehash , ['doesnt' , 'exist' ], default = 5 ) == 5 )
33
+ assert dpath .util .get (ehash , '/a/b/c/f' ) == 2
34
+ assert dpath .util .get (ehash , ['a' , 'b' , 'c' , 'f' ]) == 2
35
+ assert dpath .util .get (ehash , ['a' , 'b' , 'c' , 'f' ], default = 5 ) == 2
36
+ assert dpath .util .get (ehash , ['does' , 'not' , 'exist' ], default = None ) is None
37
+ assert dpath .util .get (ehash , ['doesnt' , 'exist' ], default = 5 ) == 5
38
38
39
39
40
40
def test_get_glob_single ():
@@ -50,10 +50,10 @@ def test_get_glob_single():
50
50
},
51
51
}
52
52
53
- assert ( dpath .util .get (ehash , '/a/b/*/f' ) == 2 )
54
- assert ( dpath .util .get (ehash , ['a' , 'b' , '*' , 'f' ]) == 2 )
55
- assert ( dpath .util .get (ehash , ['a' , 'b' , '*' , 'f' ], default = 5 ) == 2 )
56
- assert ( dpath .util .get (ehash , ['doesnt' , '*' , 'exist' ], default = 6 ) == 6 )
53
+ assert dpath .util .get (ehash , '/a/b/*/f' ) == 2
54
+ assert dpath .util .get (ehash , ['a' , 'b' , '*' , 'f' ]) == 2
55
+ assert dpath .util .get (ehash , ['a' , 'b' , '*' , 'f' ], default = 5 ) == 2
56
+ assert dpath .util .get (ehash , ['doesnt' , '*' , 'exist' ], default = 6 ) == 6
57
57
58
58
59
59
def test_get_glob_multiple ():
@@ -96,16 +96,16 @@ def test_values():
96
96
}
97
97
98
98
ret = dpath .util .values (ehash , '/a/b/c/*' )
99
- assert ( isinstance (ret , list ) )
100
- assert ( 0 in ret )
101
- assert ( 1 in ret )
102
- assert ( 2 in ret )
99
+ assert isinstance (ret , list )
100
+ assert 0 in ret
101
+ assert 1 in ret
102
+ assert 2 in ret
103
103
104
104
ret = dpath .util .values (ehash , ['a' , 'b' , 'c' , '*' ])
105
- assert ( isinstance (ret , list ) )
106
- assert ( 0 in ret )
107
- assert ( 1 in ret )
108
- assert ( 2 in ret )
105
+ assert isinstance (ret , list )
106
+ assert 0 in ret
107
+ assert 1 in ret
108
+ assert 2 in ret
109
109
110
110
111
111
@mock .patch ('dpath.util.search' )
@@ -126,7 +126,7 @@ def test_none_values():
126
126
d = {'p' : {'a' : {'t' : {'h' : None }}}}
127
127
128
128
v = dpath .util .get (d , 'p/a/t/h' )
129
- assert ( v is None )
129
+ assert v is None
130
130
131
131
132
132
def test_values_list ():
@@ -142,8 +142,8 @@ def test_values_list():
142
142
}
143
143
144
144
ret = dpath .util .values (a , 'actions/*' )
145
- assert ( isinstance (ret , list ) )
146
- assert ( len (ret ) == 2 )
145
+ assert isinstance (ret , list )
146
+ assert len (ret ) == 2
147
147
148
148
149
149
def test_non_leaf_leaf ():
0 commit comments