ewatercycle.testing.fake_models

Fake BMI models.

Module Contents

exception ewatercycle.testing.fake_models.SomeException

Bases: Exception

Common base class for all non-exit exceptions.

Initialize self. See help(type(self)) for accurate signature.

class ewatercycle.testing.fake_models.FailingModel(exc=SomeException())

Bases: bmipy.Bmi

initialize(filename)
update()
update_until(time: float) None
finalize()
get_component_name()
get_input_item_count() int
get_output_item_count() int
get_input_var_names()
get_output_var_names()
get_start_time()
get_current_time()
get_end_time()
get_time_step()
get_time_units()
get_var_type(name)
get_var_units(name)
get_var_itemsize(name)
get_var_nbytes(name)
get_var_grid(name)
get_value(name, dest)
get_value_ptr(name)
get_value_at_indices(name, dest, inds)
set_value(name, src)
set_value_at_indices(name, inds, src)
get_grid_shape(grid, shape)
get_grid_x(grid, x)
get_grid_y(grid, y)
get_grid_z(grid, z)
get_grid_spacing(grid, spacing)
get_grid_origin(grid, origin)
get_grid_rank(grid)
get_grid_size(grid)
get_grid_type(grid)
get_var_location(name: str) str
get_grid_node_count(grid: int) int
get_grid_edge_count(grid: int) int
get_grid_face_count(grid: int) int
get_grid_edge_nodes(grid: int, edge_nodes: numpy.ndarray) numpy.ndarray
get_grid_face_nodes(grid: int, face_nodes: numpy.ndarray) numpy.ndarray
get_grid_nodes_per_face(grid: int, nodes_per_face: numpy.ndarray) numpy.ndarray
get_grid_face_edges(grid: int, face_edges: numpy.ndarray) numpy.ndarray
class ewatercycle.testing.fake_models.NotImplementedModel(exc=NotImplementedError())

Bases: FailingModel

class ewatercycle.testing.fake_models.WithMocksMixin

Mock the bmi methods that return None and have no getter companion.

Use instance.mock.<method name>.assert_called_once_with() to check if the method is called correctly.

initialize(config_file: str) None
finalize()
class ewatercycle.testing.fake_models.WithDailyMixin

Mock the bmi methods that deal wtih time.

Behaves like a daily model which started since epoch.

update()
get_current_time()
get_start_time()
get_end_time()
get_time_step()
get_time_units()
class ewatercycle.testing.fake_models.DummyModelWith2DRectilinearGrid

Bases: WithMocksMixin, WithDailyMixin, NotImplementedModel

Mock the bmi methods that return None and have no getter companion.

Use instance.mock.<method name>.assert_called_once_with() to check if the method is called correctly.

get_output_var_names() tuple[str]
get_var_type(name)
get_var_grid(name)
get_var_units(name)
get_var_itemsize(name)
get_var_nbytes(name)
get_grid_type(grid)
get_grid_size(grid)
get_grid_rank(grid: int) int
get_grid_shape(grid: int, shape: numpy.ndarray) numpy.ndarray
get_value(name, dest)
get_value_at_indices(name, dest, inds)
set_value(name, src)
set_value_at_indices(name, inds, src)
get_grid_x(grid: int, x: numpy.ndarray) numpy.ndarray
get_grid_y(grid: int, y: numpy.ndarray) numpy.ndarray