Ejemplo n.º 1
0
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(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 (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(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 (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(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 (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(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 (update_references or are_identical_files(expected, reached))
Ejemplo n.º 2
0
def test_under_condition():
    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:
        sys.stdout = f
        best_match_under_conditions("parionssport", 1.7, 10)
    sys.stdout = original_stdout
    assert (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:
        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))

    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:
        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))
                                               find_surebets_interface, odds_match_surebets_interface,
                                               find_values_interface, odds_match_values_interface)

PATH_DATA = os.path.dirname(sb.__file__) + "/resources/data.json"

print(r"""
   _____                  __             __         __  __  _            
  / ___/____  ____  _____/ /______      / /_  ___  / /_/ /_(_)___  ____ _
  \__ \/ __ \/ __ \/ ___/ __/ ___/_____/ __ \/ _ \/ __/ __/ / __ \/ __ `/
 ___/ / /_/ / /_/ / /  / /_(__  )_____/ /_/ /  __/ /_/ /_/ / / / / /_/ / 
/____/ .___/\____/_/   \__/____/     /_.___/\___/\__/\__/_/_/ /_/\__, /  
    /_/                                                         /____/   
""")

try:
    sb.ODDS = load_odds(PATH_DATA)
except FileNotFoundError:
    pass

sb.DB_MANAGEMENT = "--db" in sys.argv
nb_bookmakers = len(sb.BOOKMAKERS)


# All the stuff inside your window.
sg.set_options(enable_treeview_869_patch=False)
parsing_layout = [
    [
        sg.Listbox(sb.SPORTS, size=(20, 6), key="SPORT", enable_events=True),
        sg.Column([[sg.Listbox((), size=(27, 12), key='COMPETITIONS', select_mode='multiple')],
                   [sg.Button("Tout désélectionner", key="SELECT_NONE_COMPETITION")],
                   [sg.Button("Compétitions actuelles", key="CURRENT_COMPETITIONS", visible=sb.DB_MANAGEMENT)],