Skip to content

Commit

Permalink
uddate references bool
Browse files Browse the repository at this point in the history
  • Loading branch information
pretrehr committed Sep 5, 2021
1 parent 629251c commit eef4c79
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions sportsbetting/non_regression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,69 +21,69 @@ def are_identical_files(filename1, filename2):
return False


def test_under_condition():
def test_under_condition(update_references=False):
PATH_DATA_TEST = os.path.dirname(sb.__file__) + "/resources/data_test.json"
sb.ODDS = load_odds(PATH_DATA_TEST)
original_stdout = sys.stdout
reached = os.path.dirname(sb.__file__) + "/tests/result_under_condition_1_reached.txt"
expected = os.path.dirname(sb.__file__) + "/tests/result_under_condition_1_expected.txt"
with open(reached, "w", encoding="utf-8") as f:
with open(expected if update_references else reached, "w", encoding="utf-8") as f:
sys.stdout = f
best_match_under_conditions("parionssport", 1.7, 10)
sys.stdout = original_stdout
assert(are_identical_files(expected, reached))
assert(update_references or are_identical_files(expected, reached))

reached = os.path.dirname(sb.__file__) + "/tests/result_under_condition_2_reached.txt"
expected = os.path.dirname(sb.__file__) + "/tests/result_under_condition_2_expected.txt"
with open(reached, "w", encoding="utf-8") as f:
with open(expected if update_references else reached, "w", encoding="utf-8") as f:
sys.stdout = f
best_match_under_conditions("parionssport", 1.7, 10, date_min="23/11/2020")
sys.stdout = original_stdout
assert(are_identical_files(expected, reached))
assert(update_references or are_identical_files(expected, reached))

reached = os.path.dirname(sb.__file__) + "/tests/result_under_condition_3_reached.txt"
expected = os.path.dirname(sb.__file__) + "/tests/result_under_condition_3_expected.txt"
with open(reached, "w", encoding="utf-8") as f:
with open(expected if update_references else reached, "w", encoding="utf-8") as f:
sys.stdout = f
best_match_under_conditions("parionssport", 1.7, 10, date_min="23/11/2020", date_max="29/11/2020")
sys.stdout = original_stdout
assert(are_identical_files(expected, reached))
assert(update_references or are_identical_files(expected, reached))

def test_under_condition_same_site():
def test_under_condition_same_site(update_references=False):
PATH_DATA_TEST = os.path.dirname(sb.__file__) + "/resources/data_test.json"
sb.ODDS = load_odds(PATH_DATA_TEST)
original_stdout = sys.stdout
reached = os.path.dirname(sb.__file__) + "/tests/result_under_condition_same_site_1_reached.txt"
expected = os.path.dirname(sb.__file__) + "/tests/result_under_condition_same_site_1_expected.txt"
with open(reached, "w", encoding="utf-8") as f:
with open(expected if update_references else reached, "w", encoding="utf-8") as f:
sys.stdout = f
best_match_under_conditions2("pmu", 1.4, 10)
sys.stdout = original_stdout
assert(are_identical_files(expected, reached))
assert(update_references or are_identical_files(expected, reached))

original_stdout = sys.stdout
reached = os.path.dirname(sb.__file__) + "/tests/result_under_condition_same_site_2_reached.txt"
expected = os.path.dirname(sb.__file__) + "/tests/result_under_condition_same_site_2_expected.txt"
with open(reached, "w", encoding="utf-8") as f:
with open(expected if update_references else reached, "w", encoding="utf-8") as f:
sys.stdout = f
best_match_under_conditions2("pmu", 2.6, 10)
sys.stdout = original_stdout
assert(are_identical_files(expected, reached))
assert(update_references or are_identical_files(expected, reached))

original_stdout = sys.stdout
reached = os.path.dirname(sb.__file__) + "/tests/result_under_condition_same_site_3_reached.txt"
expected = os.path.dirname(sb.__file__) + "/tests/result_under_condition_same_site_3_expected.txt"
with open(reached, "w", encoding="utf-8") as f:
with open(expected if update_references else reached, "w", encoding="utf-8") as f:
sys.stdout = f
best_match_under_conditions2("pmu", 2.6, 10, date_min="24/11/2020")
sys.stdout = original_stdout
assert(are_identical_files(expected, reached))
assert(update_references or are_identical_files(expected, reached))

original_stdout = sys.stdout
reached = os.path.dirname(sb.__file__) + "/tests/result_under_condition_same_site_4_reached.txt"
expected = os.path.dirname(sb.__file__) + "/tests/result_under_condition_same_site_4_expected.txt"
with open(reached, "w", encoding="utf-8") as f:
with open(expected if update_references else reached, "w", encoding="utf-8") as f:
sys.stdout = f
best_match_under_conditions2("pmu", 2.6, 10, date_min="24/11/2020", date_max="29/11/2020")
sys.stdout = original_stdout
assert(are_identical_files(expected, reached))
assert(update_references or are_identical_files(expected, reached))

0 comments on commit eef4c79

Please sign in to comment.