Exemplo n.º 1
0
def transform_teams():
    files = [path for path in os.listdir("data/teams") if path.endswith("txt")]
    for conference_file in files:
        year = int(conference_file.replace("teams_", "").replace(".txt", ""))
        filename = "teams_{0}.json".format(year)

        with open(os.path.join("data/teams", conference_file)) as f:
            data = parity.parse_conferences(f, year)

        with open(os.path.join("data/teams", filename), "w") as f:
            json.dump(data, f)
def test_conference_output():
    assert_equals(parse_conferences(CONFERENCE_2010, 2010), OUTPUT_2010)