Skip to content

Commit

Permalink
new ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrakenhoff committed Aug 15, 2024
1 parent 8e66e53 commit dac5d86
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 49 deletions.
24 changes: 12 additions & 12 deletions tests/test_002_connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_update_metadata(request, conn):
conn.del_oseries("test_df")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_add_oseries(conn):
o = pd.read_csv("./tests/data/obs.csv", index_col=0, parse_dates=True)
conn.add_oseries(
Expand All @@ -189,7 +189,7 @@ def test_add_oseries(conn):
)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_add_stress(conn):
s = pd.read_csv("./tests/data/rain.csv", index_col=0, parse_dates=True)
conn.add_stress(
Expand All @@ -200,39 +200,39 @@ def test_add_stress(conn):
)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_get_oseries(request, conn):
depends(request, [f"test_add_oseries[{conn.type}]"])
_ = conn.get_oseries("oseries1")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_get_oseries_and_metadata(request, conn):
depends(request, [f"test_add_oseries[{conn.type}]"])
_ = conn.get_oseries("oseries1", return_metadata=True)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_get_stress(request, conn):
depends(request, [f"test_add_stress[{conn.type}]"])
s = conn.get_stresses("prec")
s.name = "prec"


@pytest.mark.dependency()
@pytest.mark.dependency
def test_get_stress_and_metadata(request, conn):
depends(request, [f"test_add_stress[{conn.type}]"])
s, _ = conn.get_stresses("prec", return_metadata=True)
s.name = "prec"


@pytest.mark.dependency()
@pytest.mark.dependency
def test_oseries_prop(request, conn):
depends(request, [f"test_add_oseries[{conn.type}]"])
_ = conn.oseries


@pytest.mark.dependency()
@pytest.mark.dependency
def test_stresses_prop(request, conn):
depends(request, [f"test_add_stress[{conn.type}]"])
_ = conn.stresses
Expand All @@ -242,19 +242,19 @@ def test_repr(conn):
conn.__repr__()


@pytest.mark.dependency()
@pytest.mark.dependency
def test_del_oseries(request, conn):
depends(request, [f"test_add_oseries[{conn.type}]"])
conn.del_oseries("oseries1")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_del_stress(request, conn):
depends(request, [f"test_add_stress[{conn.type}]"])
conn.del_stress("prec")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_empty_library(request, conn):
s1 = pd.Series(
index=pd.date_range("2000", periods=10, freq="D"),
Expand All @@ -266,7 +266,7 @@ def test_empty_library(request, conn):
conn.empty_library("oseries", prompt=False, progressbar=False)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_delete(request, conn):
# no need to delete dictconnector (in memory)
if conn.conn_type == "arcticdb":
Expand Down
38 changes: 19 additions & 19 deletions tests/test_003_pastastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
import pastastore as pst


@pytest.mark.dependency()
@pytest.mark.dependency
def test_iter_oseries(pstore):
_ = list(pstore.iter_oseries())


@pytest.mark.dependency()
@pytest.mark.dependency
def test_iter_stresses(pstore):
_ = list(pstore.iter_stresses())


@pytest.mark.dependency()
@pytest.mark.dependency
def test_get_tmintmax(pstore):
ostt = pstore.get_tmin_tmax("oseries")
assert ostt.at["oseries1", "tmin"] == pd.Timestamp("2010-01-14")
Expand All @@ -36,19 +36,19 @@ def test_get_tmintmax(pstore):
pstore.del_model("oseries1")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_search(pstore):
results = pstore.search("oseries", "OSER", case_sensitive=False)
assert len(results) == 3
assert len(set(results) - {"oseries1", "oseries2", "oseries3"}) == 0


@pytest.mark.dependency()
@pytest.mark.dependency
def test_create_model(pstore):
_ = pstore.create_model("oseries1")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_properties(pstore):
pstore.add_oseries(pd.Series(dtype=np.float64), "deleteme", validate=False)
pstore.add_stress(
Expand All @@ -67,14 +67,14 @@ def test_properties(pstore):
pstore.del_stress("deleteme")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_store_model(request, pstore):
depends(request, [f"test_create_model[{pstore.type}]"])
ml = pstore.create_model("oseries1")
pstore.conn.add_model(ml)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_model_accessor(request, pstore):
depends(request, [f"test_store_model[{pstore.type}]"])
# repr
Expand All @@ -93,7 +93,7 @@ def test_model_accessor(request, pstore):
pstore.del_models("oseries1_2")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_oseries_model_accessor(request, pstore):
depends(request, [f"test_store_model[{pstore.type}]"])
# repr
Expand All @@ -114,7 +114,7 @@ def test_oseries_model_accessor(request, pstore):
assert len(ml_list3) == 1


@pytest.mark.dependency()
@pytest.mark.dependency
def test_store_model_missing_series(request, pstore):
depends(
request,
Expand All @@ -135,7 +135,7 @@ def test_store_model_missing_series(request, pstore):
pstore.add_model(ml)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_get_model(request, pstore):
depends(
request,
Expand All @@ -148,7 +148,7 @@ def test_get_model(request, pstore):
_ = pstore.conn.get_models("oseries1")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_del_model(request, pstore):
depends(
request,
Expand All @@ -162,36 +162,36 @@ def test_del_model(request, pstore):
pstore.conn.del_models("oseries1")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_create_models(pstore):
_ = pstore.create_models_bulk(
["oseries1", "oseries2"], store=True, progressbar=False
)
_ = pstore.conn.models


@pytest.mark.dependency()
@pytest.mark.dependency
def test_get_parameters(request, pstore):
depends(request, [f"test_create_models[{pstore.type}]"])
p = pstore.get_parameters(progressbar=False, param_value="initial")
assert p.index.size == 2
assert p.isna().sum().sum() == 0


@pytest.mark.dependency()
@pytest.mark.dependency
def test_get_signatures(request, pstore):
depends(request, [f"test_create_models[{pstore.type}]"])
s = pstore.get_signatures(progressbar=False)
assert s.shape[1] == len(ps.stats.signatures.__all__)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_iter_models(request, pstore):
depends(request, [f"test_create_models[{pstore.type}]"])
_ = list(pstore.iter_models())


@pytest.mark.dependency()
@pytest.mark.dependency
def test_solve_models_and_get_stats(request, pstore):
depends(request, [f"test_create_models[{pstore.type}]"])
_ = pstore.solve_models(
Expand All @@ -201,7 +201,7 @@ def test_solve_models_and_get_stats(request, pstore):
assert stats.index.size == 2


@pytest.mark.dependency()
@pytest.mark.dependency
def test_apply(request, pstore):
depends(request, [f"test_solve_models_and_get_stats[{pstore.type}]"])

Expand All @@ -212,7 +212,7 @@ def func(ml):
assert len(result) == 2


@pytest.mark.dependency()
@pytest.mark.dependency
def test_save_and_load_model(request, pstore):
ml = pstore.create_model("oseries1")
ml.solve()
Expand Down
14 changes: 7 additions & 7 deletions tests/test_004_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def tempyaml(yaml):
os.unlink(temp.name)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_load_yaml_rechargemodel(pstore):
yamlstr = """
my_first_model: # model name
Expand All @@ -38,7 +38,7 @@ def test_load_yaml_rechargemodel(pstore):
pstore.add_model(ml)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_load_yaml_stressmodel(pstore):
yamlstr = """
my_second_model: # model name
Expand All @@ -54,7 +54,7 @@ def test_load_yaml_stressmodel(pstore):
pstore.add_model(ml)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_load_yaml_wellmodel(pstore):
yamlstr = """
my_third_model: # model name
Expand All @@ -71,7 +71,7 @@ def test_load_yaml_wellmodel(pstore):
pstore.add_model(ml)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_write_load_compare_yaml(request, pstore):
depends(
request,
Expand All @@ -90,7 +90,7 @@ def test_write_load_compare_yaml(request, pstore):
os.remove("my_first_model.yaml")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_write_yaml_per_oseries(request, pstore):
depends(
request,
Expand All @@ -105,7 +105,7 @@ def test_write_yaml_per_oseries(request, pstore):
os.remove("oseries2.yaml")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_write_yaml_minimal(request, pstore):
depends(
request,
Expand All @@ -120,7 +120,7 @@ def test_write_yaml_minimal(request, pstore):
os.remove("my_first_model.yaml")


@pytest.mark.dependency()
@pytest.mark.dependency
def test_write_yaml_minimal_nearest(request, pstore):
depends(
request,
Expand Down
12 changes: 6 additions & 6 deletions tests/test_005_maps_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_plot_stresses_availability(pstore):
plt.close(ax.figure)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_cumulative_hist(request, pstore):
ml1 = pstore.create_model("oseries1")
pstore.add_model(ml1)
Expand All @@ -35,7 +35,7 @@ def test_cumulative_hist(request, pstore):
# %% maps


@pytest.mark.bgmap()
@pytest.mark.bgmap
def test_map_oseries_w_bgmap(pstore):
ax = pstore.maps.oseries()
# only test bgmap once for pas
Expand All @@ -57,25 +57,25 @@ def test_map_stresslinks(pstore):
plt.close(ax.figure)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_map_models(request, pstore):
ax = pstore.maps.models()
plt.close(ax.figure)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_map_model(request, pstore):
depends(request, [f"test_map_models[{pstore.type}]"])
ax = pstore.maps.model("oseries1")
plt.close(ax.figure)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_map_modelstat(request, pstore):
ax = pstore.maps.modelstat("evp")
plt.close(ax.figure)


@pytest.mark.dependency()
@pytest.mark.dependency
def test_list_ctx_providers(request, pstore):
pstore.maps._list_contextily_providers()
Loading

0 comments on commit dac5d86

Please sign in to comment.