def test_cas_sort(correctly_formatted_cas_df):
    """ Test that CollectiveActions is sortable. """
    cas_from_df = CollectiveActions.read_from_df(correctly_formatted_cas_df)
    sorted_cas = cas_from_df.sort()
    assert sorted_cas.cas[0].date == dateparser.parse("2019-04-02").date()
    reverse_sorted_cas = cas_from_df.sort(reverse=True)
    assert reverse_sorted_cas.cas[0].date == dateparser.parse(
        "2019-04-10").date()
def get_cas_from_csv():
    df = pd.read_csv(CSV)
    return CollectiveActions.read_from_df(df).sort()
Beispiel #3
0
def get_cas_from_json(json_path: str = JSON):
    """ Get CAS from JSON. """
    df = pd.read_json(json_path)
    return CollectiveActions.read_from_df(df).sort()
def test_cas_read_from_df(correctly_formatted_cas_df):
    """ Test CollectiveActions `read_from_df` function. """
    cas = CollectiveActions.read_from_df(correctly_formatted_cas_df)
    _test_cas(cas)
Beispiel #5
0
def get_cas_from_csv(csv_path: str = CSV):
    """ Get CAS from CSV. """
    df = pd.read_csv(csv_path)
    return CollectiveActions.read_from_df(df).sort()