This repository has been archived by the owner on May 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added func exclude_unpopular: removes unnecessary events that was referred in issue #87 * Less patterns * Redundant parameter "r"
- Loading branch information
Showing
9 changed files
with
498 additions
and
2 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
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,37 @@ | ||
import logging | ||
import pickle | ||
import json | ||
from os import path | ||
|
||
from surebet.tests.handling import package_dir | ||
from surebet.json_funcs import json_dumps, obj_dumps | ||
from surebet.handling.excluding import exclude_unpopular | ||
|
||
resource_dir = path.join(package_dir, "unpopular") | ||
|
||
|
||
def read_sample(filename): | ||
with open(path.join(resource_dir, filename), "rb") as found_file: | ||
obj = pickle.load(found_file) | ||
return obj | ||
|
||
|
||
def test_sample(): | ||
for sample_num in range(3): | ||
filename = 'sample{}.pkl'.format(sample_num) | ||
surebets = read_sample(filename) | ||
exclude_unpopular(surebets) | ||
|
||
logging.info("PASS: samples") | ||
|
||
|
||
def test_known_result(): | ||
surebets = read_sample("known.pkl") | ||
exclude_unpopular(surebets) | ||
|
||
with open(path.join(resource_dir, "knownResult.json")) as file_result: | ||
surebets_result = json.load(file_result) | ||
|
||
assert obj_dumps(surebets) == json_dumps(surebets_result) | ||
|
||
logging.info("PASS: known") |
Binary file not shown.
Oops, something went wrong.