pommes.tests.test_catalogue

Tests for the catalogue of variable and constraint stages (#151).

Attributes

AREA

HOUR

YEAR_OP

YEAR_INV

_DATASETS

Functions

model()

test_helpers_create_and_register(model)

A typed helper creates the linopy object and its entry together.

test_queries_match_the_benders_split(model)

The queries give what the Benders rules give on the same names.

test_module_is_required()

test_a_built_model_has_no_writing_module(parameters)

test_duplicate_name_is_refused(model)

test_dims_contradicting_the_stage_are_refused(stage, ...)

test_a_state_has_neither_hour_nor_investment_year(...)

test_a_state_with_the_wrong_dims_or_stage_is_refused(...)

test_state_in_must_name_a_state(model)

test_solver_additions_are_not_the_models(model)

test_annual_cost_may_carry_the_condition()

An operation cost per condition is annual: the expectation comes later.

test_mistagged_variable_is_not_created()

A refused tag leaves neither a variable nor an entry behind.

test_definition_must_name_a_known_variable(model)

test_check_reports_entries_the_model_does_not_have(model)

test_untagged_entries_are_refused(model)

A plain linopy call leaves a variable without an entry: the build fails.

test_contract_power_is_an_annual_shared_decision(two_areas)

_window(p)

The model of a window of hours, states and fixing rows included.

_split(p)

The model of a year cut into sub-periods of one day.

_declared(names, present)

The catalogued names the model still holds.

test_the_benders_split_follows_the_catalogue(fixture, ...)

What the master keeps and a subproblem pins or drops is declared.

test_a_shared_decision_forbids_cutting_a_year_by_condition(...)

TURPE's contract power: the conditions of a year stay one subproblem.

test_the_window_follows_the_catalogue(parameters_window)

A window pins the planning variables and the states, drops the rest.

test_window_states_are_catalogued(parameters_window)

test_subperiod_states_are_planning_states(parameters)

test_every_entry_names_its_module(...)

test_annual_couplings_are_flagged(...)

test_specs_are_immutable()

test_the_catalogue_survives_json(...)

test_a_solution_carries_its_catalogue(model)

_as_solution(model)

A dataset shaped like the solution of a model, without catalogue.

test_legacy_names_rebuild_the_catalogue_of_a_solution(...)

The rules of 0.10.0 give every variable the stage the module declares.

test_legacy_names_leave_out_what_no_rule_covers(caplog)

Module Contents

pommes.tests.test_catalogue.AREA
pommes.tests.test_catalogue.HOUR
pommes.tests.test_catalogue.YEAR_OP
pommes.tests.test_catalogue.YEAR_INV
pommes.tests.test_catalogue.model()
pommes.tests.test_catalogue.test_helpers_create_and_register(model)

A typed helper creates the linopy object and its entry together.

pommes.tests.test_catalogue.test_queries_match_the_benders_split(model)

The queries give what the Benders rules give on the same names.

pommes.tests.test_catalogue.test_module_is_required()
pommes.tests.test_catalogue.test_a_built_model_has_no_writing_module(parameters)
pommes.tests.test_catalogue.test_duplicate_name_is_refused(model)
pommes.tests.test_catalogue.test_dims_contradicting_the_stage_are_refused(stage, role, dims, message)
pommes.tests.test_catalogue.test_a_state_has_neither_hour_nor_investment_year(stage, dims)
pommes.tests.test_catalogue.test_a_state_with_the_wrong_dims_or_stage_is_refused(stage, dims, message)
pommes.tests.test_catalogue.test_state_in_must_name_a_state(model)
pommes.tests.test_catalogue.test_solver_additions_are_not_the_models(model)
pommes.tests.test_catalogue.test_annual_cost_may_carry_the_condition()

An operation cost per condition is annual: the expectation comes later.

pommes.tests.test_catalogue.test_mistagged_variable_is_not_created()

A refused tag leaves neither a variable nor an entry behind.

pommes.tests.test_catalogue.test_definition_must_name_a_known_variable(model)
pommes.tests.test_catalogue.test_check_reports_entries_the_model_does_not_have(model)
pommes.tests.test_catalogue.test_untagged_entries_are_refused(model)

A plain linopy call leaves a variable without an entry: the build fails.

pommes.tests.test_catalogue.test_contract_power_is_an_annual_shared_decision(two_areas)
pommes.tests.test_catalogue._window(p)

The model of a window of hours, states and fixing rows included.

pommes.tests.test_catalogue._split(p)

The model of a year cut into sub-periods of one day.

pommes.tests.test_catalogue._DATASETS
pommes.tests.test_catalogue._declared(names, present)

The catalogued names the model still holds.

pommes.tests.test_catalogue.test_the_benders_split_follows_the_catalogue(fixture, request)

What the master keeps and a subproblem pins or drops is declared.

On every module, the retrofit caps included – planning constraints the name rules used to list by hand –, and on a year cut into sub-periods with its planning states.

pommes.tests.test_catalogue.test_a_shared_decision_forbids_cutting_a_year_by_condition(two_areas)

TURPE’s contract power: the conditions of a year stay one subproblem.

pommes.tests.test_catalogue.test_the_window_follows_the_catalogue(parameters_window)

A window pins the planning variables and the states, drops the rest.

pommes.tests.test_catalogue.test_window_states_are_catalogued(parameters_window)
pommes.tests.test_catalogue.test_subperiod_states_are_planning_states(parameters)
pommes.tests.test_catalogue.test_every_entry_names_its_module(parameters_retrofit_conversion_single_horizon)
pommes.tests.test_catalogue.test_annual_couplings_are_flagged(parameters_flexible_demand)
pommes.tests.test_catalogue.test_specs_are_immutable()
pommes.tests.test_catalogue.test_the_catalogue_survives_json(parameters_flexible_demand)
pommes.tests.test_catalogue.test_a_solution_carries_its_catalogue(model)
pommes.tests.test_catalogue._as_solution(model)

A dataset shaped like the solution of a model, without catalogue.

pommes.tests.test_catalogue.test_legacy_names_rebuild_the_catalogue_of_a_solution(fixture, request, caplog)

The rules of 0.10.0 give every variable the stage the module declares.

For a result written before the catalogue existed: the names, with the dimensions for the states, on every module, a window and a year cut into sub-periods. A derived operation variable comes out a decision, the one difference the names never carried.

pommes.tests.test_catalogue.test_legacy_names_leave_out_what_no_rule_covers(caplog)