File tree Expand file tree Collapse file tree 3 files changed +8
-63
lines changed
Expand file tree Collapse file tree 3 files changed +8
-63
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,10 @@ def get_words_in_path():
2929 with open ("ml_config.json" ) as f :
3030 result = json .load (f )
3131 # use the list to build a new file path
32- return result ["words_in_path" ]
32+ for i in result ["features" ]:
33+ if "WordInPath" == i ["type" ]:
34+ return i ["kwargs" ]["words" ]
35+ raise AttributeError ('"WordInPath" not found in "ml_config.json"' )
3336
3437
3538def get_file_scope (path_without_extension : str ):
Original file line number Diff line number Diff line change 1- import json
21import random
32import unittest
4- from pathlib import Path
53
6- from download_data import get_file_scope
4+ from download_data import get_file_scope , get_words_in_path
75
86
97class DownloadTest (unittest .TestCase ):
@@ -25,8 +23,9 @@ def test_get_file_scope(self):
2523 get_file_scope ("packages/src/lib/__tests__/fixtures/request.json" ))
2624 self .assertEqual ("/_/" ,
2725 get_file_scope ("X3" ))
28- with open (Path (__file__ ).parent / "word_in_path.json" ) as f :
29- words = json .load (f )
26+
27+ def test_get_words_in_path (self ):
28+ words = get_words_in_path ()
3029 big_path = '/' .join (words )
3130 file_scope_1 = get_file_scope (big_path )
3231 self .assertTrue (all (x in file_scope_1 for x in words ))
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments