Skip to content

Commit 4969be1

Browse files
committed
fix
1 parent 56a2a2c commit 4969be1

File tree

3 files changed

+8
-63
lines changed

3 files changed

+8
-63
lines changed

download_data.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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

3538
def get_file_scope(path_without_extension: str):

test_download_data.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import json
21
import random
32
import 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

97
class 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))

word_in_path_apply.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)