File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,15 @@ def get_paths_values(db, query_str):
9191 :param query_str: Description
9292 """
9393 query_str = f"SELECT * FROM data where { query_str } ;"
94- res = db .execute (query_str , ignore_error = False ).fetchall ()
94+ response = db .execute (query_str , ignore_error = False ).fetchall ()
95+ res = {}
96+ for r in response :
97+ path = r ["path" ]
98+ # ensure distinct paths
99+ if path not in res .keys ():
100+ r = nest_dict (r )
101+ r .pop ("path" )
102+ res [path ] = r
95103 return res
96104
97105
Original file line number Diff line number Diff line change @@ -80,9 +80,10 @@ def test_data_query(self):
8080 target = 1
8181 self .assertEqual (source , target )
8282
83- source = len (pathtraits .access .get_paths (self .db , "TRUE" ))
84- target = 3
85- self .assertEqual (source , target )
83+ traits = pathtraits .access .get_paths_values (self .db , "TRUE" )
84+ self .assertEqual (len (traits ), 3 )
85+ for v in traits .values ():
86+ self .assertTrue ("path" not in v .keys ())
8687
8788
8889if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments