Skip to content

Commit

Permalink
Merge pull request #51 from frank1010111/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
frank1010111 authored Sep 24, 2024
2 parents a3017eb + 8752feb commit 0a60f73
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
additional_dependencies: [black==23.7.0]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.7"
rev: "v0.6.7"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
9 changes: 5 additions & 4 deletions tests/flow/test_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import numpy as np
import pandas as pd
import pytest
from scipy.interpolate import interp1d

from bluebonnet.flow.flowproperties import (
FlowPropertiesTwoPhase,
RelPermParams,
relative_permeabilities,
relative_permeabilities_twophase,
rescale_pseudopressure,
)
from scipy.interpolate import interp1d

pr = 8_000.0
Sw = 0.1
Expand All @@ -36,7 +37,7 @@
pvt_oil = pd.read_csv("tests/data/pvt_oil.csv").rename(columns=columns_renamer_oil)


@pytest.fixture()
@pytest.fixture
def relperm_params():
return RelPermParams(
n_o=1,
Expand All @@ -51,7 +52,7 @@ def relperm_params():
)


@pytest.fixture()
@pytest.fixture
def saturations_test():
return pd.DataFrame(
{
Expand All @@ -62,7 +63,7 @@ def saturations_test():
)


@pytest.fixture()
@pytest.fixture
def df_pvt():
# get pvt tables
pvt_oil = pd.read_csv("tests/data/pvt_oil.csv")
Expand Down
4 changes: 3 additions & 1 deletion tests/flow/test_reservoir.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
import numpy as np
import pandas as pd
import pytest
from scipy.optimize import curve_fit

from bluebonnet.flow import (
FlowProperties,
IdealReservoir,
MultiPhaseReservoir,
SinglePhaseReservoir,
)
from scipy.optimize import curve_fit

nx = (30,)
nt = (1200,)
Expand Down Expand Up @@ -108,6 +109,7 @@ def test_rf_late_asymptotes(self, nx, pf, pi, fluid, Reservoir, nt):
reservoir.simulate(time)
if False:
import matplotlib.pyplot as plt

from bluebonnet.plotting import plot_pseudopressure, plot_recovery_factor

fig, ax = plt.subplots()
Expand Down
3 changes: 2 additions & 1 deletion tests/fluids/test_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

import numpy as np
import pytest

from bluebonnet.fluids import Fluid


@pytest.fixture()
@pytest.fixture
def fluid_instance(oil_properties):
fluid = Fluid(
oil_properties.temperature,
Expand Down
1 change: 1 addition & 0 deletions tests/fluids/test_gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import numpy as np
import pytest

from bluebonnet.fluids import gas

TEMPERATURE_STANDARD = 60.0
Expand Down
1 change: 1 addition & 0 deletions tests/fluids/test_oil.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import math

import pytest

from bluebonnet.fluids import oil

TEMPERATURE_STANDARD = 60.0
Expand Down
1 change: 1 addition & 0 deletions tests/fluids/test_water.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import pytest

from bluebonnet.fluids import water

TEMPERATURE_STANDARD = 60.0
Expand Down
9 changes: 5 additions & 4 deletions tests/forecast/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import numpy as np
import pandas as pd
import pytest
from lmfit import Parameters

from bluebonnet.flow import FlowProperties, IdealReservoir, SinglePhaseReservoir
from bluebonnet.forecast import (
Bounds,
ForecasterOnePhase,
fit_production_pressure,
plot_production_comparison,
)
from lmfit import Parameters

t_end = 6.0
nx = 40
Expand All @@ -22,7 +23,7 @@
time_scaled = np.linspace(0, np.sqrt(t_end), nt) ** 2


@pytest.fixture()
@pytest.fixture
def rf_curve():
"""Return function for recovery factor from an ideal reservoir."""
reservoir = IdealReservoir(nx, pf, pi, None)
Expand All @@ -31,7 +32,7 @@ def rf_curve():
return reservoir.recovery_factor_interpolator()


@pytest.fixture()
@pytest.fixture
def pressure_varying_prod():
"""Necessary data for a pressure-varying system."""
tau_in = 180.0
Expand Down Expand Up @@ -88,7 +89,7 @@ def test_fit_production_pressure(pressure_varying_prod):
assert result.params["M"].value > 1e3, "is M increasing from the initial guess?"


@pytest.mark.mpl_image_compare()
@pytest.mark.mpl_image_compare
def test_fit_plot(pressure_varying_prod):
prod, pvt_table = pressure_varying_prod
params = Parameters()
Expand Down
9 changes: 5 additions & 4 deletions tests/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import numpy as np
import pandas as pd
import pytest

from bluebonnet.flow import FlowProperties
from bluebonnet.plotting import (
SinglePhaseReservoir,
Expand All @@ -29,7 +30,7 @@
fluid = FlowProperties(pvt_gas, pi)


@pytest.fixture()
@pytest.fixture
def reservoir():
reservoir = SinglePhaseReservoir(nx, pressure_fracface=pf, pressure_initial=pi, fluid=fluid)
t_end = 11
Expand All @@ -38,23 +39,23 @@ def reservoir():
return reservoir


@pytest.mark.mpl_image_compare()
@pytest.mark.mpl_image_compare
@pytest.mark.parametrize("rescale", [True, False])
def test_plot_pseudopressure(reservoir, rescale):
fig, ax = plt.subplots()
plot_pseudopressure(reservoir, every=50, ax=ax, rescale=rescale)
return fig


@pytest.mark.mpl_image_compare()
@pytest.mark.mpl_image_compare
@pytest.mark.parametrize("change_ticks", [True, False])
def test_plot_recovery_rate(reservoir, change_ticks):
fig, ax = plt.subplots()
plot_recovery_rate(reservoir, ax, change_ticks=change_ticks)
return fig


@pytest.mark.mpl_image_compare()
@pytest.mark.mpl_image_compare
@pytest.mark.parametrize("change_ticks", [True, False])
def test_plot_recovery_factor(reservoir, change_ticks):
fig, ax = plt.subplots()
Expand Down

0 comments on commit 0a60f73

Please sign in to comment.