-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
147,913 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class Data: | ||
""" | ||
Load the config data and subsequent files | ||
""" | ||
|
||
def __init__(self, data): | ||
self.data = data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import json | ||
import os | ||
from unittest.mock import mock_open, patch | ||
|
||
import pytest | ||
|
||
from PyScoutFM.importer import Importer | ||
|
||
|
||
@pytest.fixture | ||
def sample_config(): | ||
return {"ratings_path": "~/ratings.json"} | ||
|
||
|
||
@pytest.fixture | ||
def sample_ratings(): | ||
return {"rating1": 4.5, "rating2": 3.7} | ||
|
||
|
||
def test_load_config_from_file(sample_config): | ||
with patch( | ||
"builtins.open", mock_open(read_data=json.dumps(sample_config)) | ||
) as mock_file: | ||
importer = Importer("dummy_config_path.json") | ||
mock_file.assert_called_once_with("dummy_config_path.json", "r") | ||
assert importer.config == sample_config | ||
|
||
|
||
def test_get_last_file(): | ||
importer = Importer("tests/stubs/config.json") | ||
test_path = os.getcwd() + "/tests/stubs/inputs" | ||
assert importer.find_latest_file(test_path, "*.html") == test_path + "/Squad.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"import_path": "~/Documents/input", | ||
"export_path": "~/Documents/output", | ||
"ratings_path": "ratings.json", | ||
"ratings_set": "ykykyk_balanced", | ||
"filter_values_below": 45, | ||
"paginate": 30, | ||
"output_columns": [ | ||
"Name", | ||
"Age", | ||
"Club", | ||
"Transfer Value", | ||
"Wage", | ||
"1st Nat", | ||
"Position", | ||
"Personality", | ||
"Left Foot", | ||
"Right Foot" | ||
] | ||
} |
Oops, something went wrong.