From abc5bf601130d932211de55c16fdb297c6b6c318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Thu, 24 Sep 2026 05:18:01 +0200 Subject: [PATCH] Bring the fixture's method entries in line with opm-simulators tests/files/docstrings_simulators.json is a snapshot of the docstring file from opm-simulators, last refreshed in January 2025. Four of its method signatures still use names that the bindings no longer have: mpi_init now setup_mpi get_fluid_state_variable now get_fluidstate_variable get_primary_var_meaning now get_primary_variable_meaning get_primary_var_meaning_map now get_primary_variable_meaning_map OPM/opm-simulators#7439 corrected these in the real file. The fixture kept them, and a review of OPM/opm-python-documentation#31 took the fixture as the definition of the API and suggested replacing a working setup_mpi() call with mpi_init(), which does not exist. Also carries over the two other changes the real file has since had: the setupMpi docstring's inline literal no longer has a third backtick, and checkSimulationFinished documents its return type. All 17 method entries are now identical to the real file on opm-simulators master, with {{name}} expanded to BlackOilSimulator. No test depends on the fixture's contents; conftest.py only copies it into a temporary repository. --- .../tests/files/docstrings_simulators.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/sphinx_docs/tests/files/docstrings_simulators.json b/python/sphinx_docs/tests/files/docstrings_simulators.json index 34d3879..ddc780a 100644 --- a/python/sphinx_docs/tests/files/docstrings_simulators.json +++ b/python/sphinx_docs/tests/files/docstrings_simulators.json @@ -18,7 +18,7 @@ }, "checkSimulationFinished": { "signature": "opm.simulators.BlackOilSimulator.check_simulation_finished() -> bool", - "doc": "Checks if the simulation has finished.\n\n:return: True if the simulation is finished, False otherwise." + "doc": "Checks if the simulation has finished.\n\n:return: True if the simulation is finished, False otherwise.\n:type return: bool" }, "currentStep": { "signature": "opm.simulators.BlackOilSimulator.current_step() -> int", @@ -33,7 +33,7 @@ "doc": "Gets the timestep size of the last completed step.\n\n:return: Timestep size in days.\n:type return: float" }, "getFluidStateVariable": { - "signature": "opm.simulators.BlackOilSimulator.get_fluid_state_variable(name: str) -> NDArray[float]", + "signature": "opm.simulators.BlackOilSimulator.get_fluidstate_variable(name: str) -> NDArray[float]", "doc": "Retrieves a fluid state variable for the simulation grid.\n\n:param name: The name of the variable. Valid names are 'pw' (pressure water), 'pg' (pressure gas), 'po' (pressure oil), 'rho_w' (density water), 'rho_g' (density gas), 'rho_o' (density oil)'Rs' (soultion gas-oil ratio), 'Rv' (volatile gas-oil ratio), 'Sw' (water saturation), 'Sg' (gas saturation), 'So' (oil saturation), and 'T' (temperature).\n:type name: str\n\n:return: An array of fluid state variables.\n:type return: NDArray[float]" }, "getPorosity": { @@ -41,11 +41,11 @@ "doc": "Retrieves the porosity values of the simulation grid.\n\n:return: An array of porosity values.\n:type return: numpy.ndarray" }, "getPrimaryVarMeaning": { - "signature": "opm.simulators.BlackOilSimulator.get_primary_var_meaning(variable: str) -> NDArray[int]", + "signature": "opm.simulators.BlackOilSimulator.get_primary_variable_meaning(variable: str) -> NDArray[int]", "doc": "Retrieves the primary variable meaning of the simulation grid.\n\n:param variable: The name of the variable. Valid names are 'pressure', 'water', 'gas', and 'brine'.\n:type variable: str\n\n:return: An array of primary variable meanings. See ``get_primary_variable_meaning_map()`` for more information.\n:type return: NDArray[int]" }, "getPrimaryVarMeaningMap": { - "signature": "opm.simulators.BlackOilSimulator.get_primary_var_meaning_map(variable: str) -> dict[str, int]", + "signature": "opm.simulators.BlackOilSimulator.get_primary_variable_meaning_map(variable: str) -> dict[str, int]", "doc": "Retrieves the primary variable meaning map for each primary variable.\n\n:param variable: The name of the variable. Valid names are 'pressure', 'water', 'gas', and 'brine'.\n:type variable: str\n\n:return: A dictionary of primary variable meanings. The keys are the primary variable meanings and the values are the corresponding integer codes. The integer codes are used to represent the primary variable meanings in the simulation grid. For variable name 'pressure', the valid keys are: 'Po', 'Pg', and 'Pw', for variable name 'water', the valid keys are: 'Sw', 'Rvw', 'Rsw', and 'Disabled', for variable name 'gas', the valid keys are: 'Sg', 'Rs', 'Rv', and 'Disabled', for variable name 'brine', the valid keys are: 'Cs', 'Sp', and 'Disabled'.\n:type return: dict[str, int]" }, "getPrimaryVariable": { @@ -65,8 +65,8 @@ "doc": "Sets the primary variable's values for the simulation grid.\n\n:param variable: The name of the variable. Valid names are 'pressure', 'water', 'gas', and 'brine'.\n:type variable: str\n:param value: An array of primary variable values to be set. See ``get_primary_variable()`` for more information.\n:type value: NDArray[float]" }, "setupMpi": { - "signature": "opm.simulators.BlackOilSimulator.mpi_init(init: bool, finalize: bool) -> None", - "doc": "Sets MPI up for parallel simulation. This method should be called before any other method.\n\n:param init: Whether to call ``MPI_Init()`` or not.\n:param finalize: Whether to call ``MPI_Finalize()```when the simulator object goes out of scope.\n\n:return: None" + "signature": "opm.simulators.BlackOilSimulator.setup_mpi(init: bool, finalize: bool) -> None", + "doc": "Sets MPI up for parallel simulation. This method should be called before any other method.\n\n:param init: Whether to call ``MPI_Init()`` or not.\n:param finalize: Whether to call ``MPI_Finalize()`` when the simulator object goes out of scope.\n\n:return: None" }, "step": { "signature": "opm.simulators.BlackOilSimulator.step() -> int",