tests package
Submodules
tests.test_actors module
Unit tests for actor module.
Copyright 2018 G2Elab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License .
- class tests.test_actors.TestActor(methodName='runTest')[source]
Bases:
TestCaseTest of the actor class
- test_add_actor_constraint_operator()[source]
Test the add_actor_constraint method associated to an actor operating energy unit
- test_add_actor_constraint_regulator()[source]
Test the add_actor_constraint method associated to an actor non operating energy unit
- test_add_actor_dynamic_constraint_operator()[source]
Test the add_actor_dynamic_constraint method associated to an actor operating energy unit
- test_add_actor_dynamic_constraint_regulator()[source]
Test the add_actor_dynamic_constraint method associated to an actor non operating energy unit
- test_add_objective_operator()[source]
Test the add_objective method associated to an actor operating energy unit
tests.test_consumer_actors module
Unit tests for the module consumer_actors.py, defining constraints and objectives for consumer actor type.
Copyright 2018 G2Elab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_consumer_actors.TestConsumerActorConstraints(methodName='runTest')[source]
Bases:
TestCaseTest of ConsumerActor constraints
- test_energy_consumption_maximum()[source]
Test the energy_consumption_maximum constraint on two consumption units
- test_energy_consumption_maximum_without_int_or_float()[source]
Test it raises an error if max_e_tot is a list
- test_energy_consumption_minimum()[source]
Test the energy_consumption_minimum constraint on two consumption units
- test_energy_consumption_minimum_without_int_or_float()[source]
Test it raises an error if min_e_tot is a list
- test_power_consumption_by_unit_maximum()[source]
Test the power_consumption_by_unit_maximum constraint on two consumption units
- test_power_consumption_by_unit_maximum_with_dic()[source]
Test it raises an error if max_p is a list with dictionary
- test_power_consumption_by_unit_maximum_with_list()[source]
Test the power_consumption_by_unit_maximum constraint on two consumption units if max_p is a list
- test_power_consumption_by_unit_maximum_with_wrong_list()[source]
Test it raises an error if max_p is a list with a wrong dimension considering the unit time
- test_power_consumption_by_unit_minimum()[source]
Test the add_power_consumption_by_unit_minimum constraint on two consumption units
- test_power_consumption_by_unit_minimum_with_dic()[source]
Test it raises an error if min_p is a dictionary
- test_power_consumption_by_unit_minimum_with_list()[source]
Test the add_power_consumption_by_unit_minimum constraint on two consumption units if min_p is a list
- test_power_consumption_by_unit_minimum_with_wrong_list()[source]
Test it raises an error if min_p is a list with a wrong dimension considering the unit time
- test_power_consumption_total_maximum()[source]
Test the power_consumption_maximum constraint on two consumption units
- test_power_consumption_total_maximum_with_dic()[source]
Test it raises an error if max_p is a list with dictionary
- test_power_consumption_total_maximum_with_list()[source]
Test the power_consumption_maximum constraint on two consumption units if max_p is a list
- test_power_consumption_total_maximum_with_wrong_list()[source]
Test it raises an error if max_p is a list with a wrong dimension considering the unit time
- test_power_consumption_total_minimum()[source]
Test the add_power_consumption_minimum constraint on two consumption units
- test_power_consumption_total_minimum_with_dic()[source]
Test it raises an error if min_p is a dictionary
- class tests.test_consumer_actors.TestConsumerActorObjectives(methodName='runTest')[source]
Bases:
TestCaseTest of ConsumerActor objectives
- test_maximize_consumption()[source]
Test the maximize_consumption objective on two consumption units
- test_minimize_co2_consumption()[source]
Test the minimize_co2_consumption objective on two consumption units
tests.test_consumer_producer_actors module
Unit tests for the module consumer_producer_actors.py, defining constraints and objectives for consumer_producer actor type.
Copyright 2018 G2Elab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_consumer_producer_actors.TestCheckOperatedList(methodName='runTest')[source]
Bases:
TestCaseTest of _check_operated_list method dedicated to production or consumption
- class tests.test_consumer_producer_actors.TestMaximizeConsoProdMatch(methodName='runTest')[source]
Bases:
TestCaseTest of maximize_conso_prod_match method
- class tests.test_consumer_producer_actors.TestMaximizeSelfconsumptionRate(methodName='runTest')[source]
Bases:
TestCaseTest of maximize_selfconsumption_rate method
tests.test_consumption_units module
Unit tests for consumption_units module
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_consumption_units.TestDefConsumptionCostCalc(methodName='runTest')[source]
Bases:
TestCaseCheck the _def_consumption_cost_calc method
- test_dict_consumption_cost_calc()[source]
check no cost calculation if consumption_cost is a dictionary
- test_float_consumption_cost_calc()[source]
check the cost calculation if consumption_cost is a float
- class tests.test_consumption_units.TestFixedConsumptionUnit(methodName='runTest')[source]
Bases:
TestCaseCheck the FixedConsumptionUnit class
- class tests.test_consumption_units.TestInitConsumptionUnit(methodName='runTest')[source]
Bases:
TestCaseCheck the initialisation of the ConsumptionUnit class
- class tests.test_consumption_units.TestMaximizeConsumption(methodName='runTest')[source]
Bases:
TestCaseCheck the maximize_consumption method
- class tests.test_consumption_units.TestMinimizeConsumption(methodName='runTest')[source]
Bases:
TestCaseCheck the minimize_consumption method
- class tests.test_consumption_units.TestMinimizeConsumptionCost(methodName='runTest')[source]
Bases:
TestCaseCheck the minimize_consumption_cost method
tests.test_conversion_units module
Unit tests for the module conversion_units.py, defining the conversion units attributes, constraints and functions.
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_conversion_units.TestCOPFloat(methodName='runTest')[source]
Bases:
TestCase- test_conversion_constraint()[source]
Checking the conversion constraint of the heat pump is properly set
- class tests.test_conversion_units.TestCOPList(methodName='runTest')[source]
Bases:
TestCase- test_conversion_constraint()[source]
Checking the conversion constraint is properly set with a COP list
- test_cop_inf()[source]
Asserting an error is raised when at least one value of the COP list is below 1
- test_cop_inf_dict()[source]
Asserting an error is raised when at least one value of the COP dict is below 1
- class tests.test_conversion_units.TestE2HRatioList(methodName='runTest')[source]
Bases:
TestCase- test_conversion_constraint()[source]
Checking the conversion constraint with a list elec_to_therm_ratio
- test_e2hr_sup()[source]
Asserting an error is raised when at least one element of the elec_to_therm_ratio list is over 1
- test_e2hr_sup_dict()[source]
Asserting an error is raised when at least one element of the elec_to_therm_ratio dict is over 1
- class tests.test_conversion_units.TestEffRatioList(methodName='runTest')[source]
Bases:
TestCase- test_conversion_constraint()[source]
Checking the conversion constraint with a list efficiency_ratio
- test_eff_r_sup()[source]
Asserting an error is raised when at least one element of the efficiency_ratio list is over 1
- test_eff_r_sup_dict()[source]
Asserting an error is raised when at least one element of the efficiency_ratio dict is over 1
- class tests.test_conversion_units.TestEfficiencyRatioFloat(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_conversion_units.TestElec2ThermalConvUnit(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_conversion_units.TestReversibleConversionUnitCreation(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_conversion_units.TestReversibleConversionUnitEff(methodName='runTest')[source]
Bases:
TestCase
tests.test_core module
“
Copyright 2018 G2Elab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_core.TestLists(methodName='runTest')[source]
Bases:
TestCaseTest add_unit_attributes_in_lists and associated quantity, constraint and objective methods
- test_add_and_get_constraints()[source]
Test if the constraint is added into the _model_constraints_list and that the list of constraints is available with get_constraints_name_list()
- class tests.test_core.TestUnit(methodName='runTest')[source]
Bases:
TestCaseTest the OptObject class
- class tests.test_core.Testrepr(methodName='runTest')[source]
Bases:
TestCaseTest the __repr__ method
- class tests.test_core.Teststr(methodName='runTest')[source]
Bases:
TestCaseTest the __str__ method
- test_constant_quantity()[source]
Test the return considering a unit with a quantity which is constant
- test_dict_quantity()[source]
Test the return considering a unit with a quantity which is a dictionary
tests.test_electrical_system_operation module
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_electrical_system_operation.TestElectricalSystemOperation(methodName='runTest')[source]
Bases:
TestCaseUnittests for the example electrical_system_operation.py
- test_operating_cost_calculation_variable_production()[source]
Check the operating cost calculated for the variable production unit
- test_power_calculation_variable_production()[source]
Check the power calculated for the variable production unit
- test_return_fourth_fifth_production()[source]
Check if the fourth and fifth values of return is a VariableProductionUnit type Check the result of the fourth and fifth values
tests.test_electrical_vehicle module
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_electrical_vehicle.TestElectricVehicle(methodName='runTest')[source]
Bases:
TestCaseUnittests for the example electrical_system_operation.py
- test_load_profile_creation()[source]
Check if the load profile is taken into account for power values
- test_operating_cost_calculation_variable_production()[source]
Check the operating cost calculated for the variable production unit
- test_power_calculation_variable_production()[source]
Check the power calculated for the variable production unit
- test_return_fith_load()[source]
Check if the fith value of return is a FixedConsumptionUnit Check the result of the fith value
- test_return_fourth_fifth_production()[source]
Check if the fourth value of return is a VariableProductionUnit type
tests.test_elements module
Unit tests for the module elements.py, defining the quantity, constraint and objective classes
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_elements.TestActorConstraint(methodName='runTest')[source]
Bases:
TestCaseChecking the attributes of ActorConstraint are properly set
- class tests.test_elements.TestConstraint(methodName='runTest')[source]
Bases:
TestCaseChecking the attributes of Constraint are properly set
- class tests.test_elements.TestDailyDynamicConstraint(methodName='runTest')[source]
Bases:
TestCaseTesting Daily Dynamic Constraint
- test_dd_cons_init_higher_than_final_time()[source]
Checking if the ValueError is raised if init_time higher than final_time
- test_dd_cons_long_t_range()[source]
Checking t_range values when the studied period ends between the the specified init and final time
- class tests.test_elements.TestDynamicConstraint(methodName='runTest')[source]
Bases:
TestCaseChecking the attributes of Dynamic Constraint are properly set
- class tests.test_elements.TestGetValue(methodName='runTest')[source]
Bases:
TestCaseChecking the get_value() method
- class tests.test_elements.TestGetValueWithDate(methodName='runTest')[source]
Bases:
TestCaseChecking the get_value_with_date() method
- test_dict_get_correct_dataframe()[source]
Checking if get_value_with_date() on a dict gives a correct dataframe
- class tests.test_elements.TestHourlyDynamicConstraint(methodName='runTest')[source]
Bases:
TestCaseTesting Hourly Dynamic Constraint
- class tests.test_elements.TestObjective(methodName='runTest')[source]
Bases:
TestCaseChecking the attributes of Objective are properly set
- class tests.test_elements.TestQuantityDictValue(methodName='runTest')[source]
Bases:
TestCaseTesting Quantity when the value is a dict
- test_elements_opt()[source]
Checking the opt is set to False if at least one dict value is specified
- class tests.test_elements.TestQuantityFloatValue(methodName='runTest')[source]
Bases:
TestCaseTests on the Quantity class when its value is a float
- class tests.test_elements.TestQuantityNoneValue(methodName='runTest')[source]
Bases:
TestCaseTests when the quantity has no value
- test_element_none_value_below_two()[source]
Checking the value is set to 0 when opt=True and vlen=1
- test_elements_none_opt_vlen_above_two()[source]
Checking a dict of opt is created when opt=True and vlen is set>2
- class tests.test_elements.TestQuantityOtherOptObjects(methodName='runTest')[source]
Bases:
TestCaseChecking an exception is raised if opt is a list or a dict
- class tests.test_elements.TestQuantitySpecialMethodFloat(methodName='runTest')[source]
Bases:
TestCaseChecking the Str special method works properly with floats, and raises an error for lists and dicts
- class tests.test_elements.TestQuantitySpecialMethodRepr(methodName='runTest')[source]
Bases:
TestCaseChecking the Repr special method works properly with floats, lists and dicts
- class tests.test_elements.TestQuantitySpecialMethodStr(methodName='runTest')[source]
Bases:
TestCaseChecking the Str special method works properly with floats, lists and dicts
- class tests.test_elements.TestQuantityWrongOptObjects(methodName='runTest')[source]
Bases:
TestCaseChecking an error is raised if opt has a wrong type
tests.test_energy_nodes module
“
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_energy_nodes.TestAddConnectedEnergyUnits(methodName='runTest')[source]
Bases:
TestCase- test_add_only_once_to_list()[source]
Test if the EnergyUnit is not added into the connected_energy_units list when already in it.
- test_no_energy_type_for_node()[source]
Test if the energy_type of the EnergyNode becomes the energy_type of the EnergyUnit connected to the node, when there is no energy_type for the EnergyNode.
- test_no_energy_type_for_unit()[source]
Test if the energy_type of the EnergyUnit becomes the energy_type of the EnergyNode connected to the unit, when there is no energy_type for the EnergyUnit.
- test_raise_energy_type_error()[source]
Test if a TypeError is raised when the energy_type of the node is not the same as the energy_type of the unit to be connected.
- class tests.test_energy_nodes.TestAddPole(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_energy_nodes.TestCreateExport(methodName='runTest')[source]
Bases:
TestCase- test_add_to_import_list()[source]
Test if the energy export is added to the import list of the other node
- test_energy_export_to_node_is_added()[source]
Test if the Quantity energy_export is added as attribute to the node
- test_is_exporting_to_node_is_added()[source]
Test if the Quantity is_exporting is added as attribute to the node
- class tests.test_energy_nodes.TestExportToNode(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_energy_nodes.TestIsExport(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_energy_nodes.TestIsImport(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_energy_nodes.TestSetPowerBalance(methodName='runTest')[source]
Bases:
TestCase- test_if_power_balance_is_added()[source]
Test if the Constraint power_balance is added as attribute to the node
tests.test_energy_units module
“
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_energy_units.TestAddEnergyLimitsOnTimePeriod(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_energy_units.TestAssemblyUnitAttributes(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_energy_units.TestInitEnergyUnit(methodName='runTest')[source]
Bases:
TestCase- test_p_lb_int_float()[source]
Test if the expected lower bound is created for p with an int or a float
- class tests.test_energy_units.TestSetOperatingTimeRange(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_energy_units.TestWrongAssemblyUnit(methodName='runTest')[source]
Bases:
TestCase- test_no_defined_cons_units()[source]
Asserting an error is raised when no consumption unit is defined
- test_no_defined_prod_units()[source]
Asserting an error is raised when no production unit is defined
- test_no_list_cons_units()[source]
Asserting an error is raised when no list of consumption unit is defined
- test_no_list_prod_units()[source]
Asserting an error is raised when no list of production unit is defined
- test_no_list_rev_units()[source]
Asserting an error is raised when no list of reversible unit is defined
- test_wrong_cons_units()[source]
Asserting an error is raised when the objects in the list of consumption units are not consumption units
tests.test_exergy module
Unit tests for exergy analysis module
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_exergy.TestExergyAnalysis(methodName='runTest')[source]
Bases:
TestCaseTest exergy analysis class
- test_electrical_exergy_but_already_assessed()[source]
Asserting AttributeError whenever exergy analysis is attempted on a unit on which exergy analysis has already been applied
- test_electrical_exergy_but_no_energy_unit()[source]
Asserting TypeError whenever electrical exergy analysis is attempted on an object that is not an EnergyUnit
- test_electrical_exergy_but_non_electrical_unit()[source]
Asserting TypeError whenever electrical exergy analysis is attempted on a thermal unit
- test_electrical_exergy_list_but_already_assessed()[source]
Asserting AttributeError whenever exergy analysis is attempted on a list containing at least one unit where exergy is already assessed
- test_electrical_exergy_list_but_no_energy_unit()[source]
Asserting TypeError whenever electrical exergy analysis is attempted on a list of units that contains at least one object that is not an EnergyUnit
- test_electrical_exergy_list_but_non_electrical_unit()[source]
Asserting TypeError whenever electrical exergy analysis is attempted on a list of units where at least one is not an electrical unit.
- test_thermal_exergy_but_already_assessed()[source]
Asserting AttributeError whenever exergy analysis is attempted on a unit on which exergy analysis has already been applied
- test_thermal_exergy_but_no_temp()[source]
Asserting ValueError whenever thermal exergy analysis is attempted without providing a temperature
- test_thermal_exergy_but_no_temp_within_a_list()[source]
Asserting TypeError whenever ThermalExergy is attempted with a list that contains at least one temperature in a wrong format
- test_thermal_exergy_but_non_thermal_unit()[source]
Asserting TypeError whenever thermal exergy analysis is attempted on a unit whose energy type is not Thermal
- test_thermal_exergy_but_not_an_energy_unit()[source]
Asserting TypeError whenever thermal exergy analysis is attempted on an object that is not an EnergyUnit
- test_thermal_exergy_but_temp_list_different_length()[source]
Asserting IndexError whenever thermal exergy analysis is attempted on a unit that has a temperature vector with different length than the time vector
- test_thermal_exergy_but_temp_list_wrong_format()[source]
Asserting TypeError whenever Thermal exergy assessment is attempted with at least one temperature in the wrong format
- test_thermal_exergy_but_temp_wrong_format()[source]
Asserting TypeError when energy type is Thermal but the temperature is not an int, nor a float, nor a list
- test_thermal_exergy_list_but_already_assessed()[source]
Asserting AttributeError whenever exergy analysis is attempted on a list of units containing at least one on which exergy analysis has already been applied
- test_thermal_exergy_list_but_non_energy_unit()[source]
Asserting TypeError whenever thermal exergy analysis is attempted on a list of units which contains at least one object that is not an EnergyUnit
tests.test_operator_actors module
Unit tests for the module operator_actors.py, defining an operator actor.
Copyright 2018 G2Elab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_operator_actors.TestCheckOperatedUnitList(methodName='runTest')[source]
Bases:
TestCaseTest the _check_operated_unit_list method
- test_error_if_not_list()[source]
Test obj_operated_unit_list raise an error if obj_operated_unit_list is not a list
- class tests.test_operator_actors.TestCheckOperatedUnitType(methodName='runTest')[source]
Bases:
TestCaseTest the _check_unit_type method
- class tests.test_operator_actors.TestOperatorActor(methodName='runTest')[source]
Bases:
TestCaseTest OperatorActor class
- test_name_description()[source]
Test the name and the description associated to an operator_actor object
tests.test_optimisation_model module
“
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_optimisation_model.TestAddConstraints(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_optimisation_model.TestAddNode(methodName='runTest')[source]
Bases:
TestCaseTest add_nodes method
- test_adding_unit_instead_of_node()[source]
Check that it raises an error if an energyunit is added instead of a node
- class tests.test_optimisation_model.TestAddNodeAndActors(methodName='runTest')[source]
Bases:
TestCaseTest add_nodes_and_actors method
- test_adding_unit_instead_of_node()[source]
Check that it raises an error if an energyunit is added instead of a node
- class tests.test_optimisation_model.TestAddObjectives(methodName='runTest')[source]
Bases:
TestCaseTest add_objectives method
- class tests.test_optimisation_model.TestAddQuantities(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_optimisation_model.TestAddQuantity(methodName='runTest')[source]
Bases:
TestCase- test_dict_qval_with_opt()[source]
Check that the quantity is created and is a LpVariable when opt=True
- test_dict_qval_without_opt()[source]
Check that the quantity is created and is equals the value of the dictionary when opt=False
- test_int_float_qval_with_opt()[source]
Check that the quantity is created as LpVariable when opt=True
- test_int_float_qval_without_opt()[source]
Check that the quantity is created and equals the q_val when opt=False
- test_list_qval_with_opt()[source]
Check that the quantity is created and is a LpVariable when opt=True
- class tests.test_optimisation_model.TestAddUnitAttributes(methodName='runTest')[source]
Bases:
TestCase- test_add_all_children()[source]
Check if all OptObject objects contained as attributes in a OptObject are added to the _model_units_list of the model
- test_add_all_constraints()[source]
Check if all Constraint objects contained as attributes in a OptObject are added to the cosntraints_list of the model
- test_add_all_objectives()[source]
Check if all Objective objects contained as attributes in a OptObject are added to the objective_list of the model
- test_add_all_quantities()[source]
Check if all Quantity objects contained as attributes in a OptObject are added to the _model_quantities_list of the model
- test_constraint_parent()[source]
Check if the parent of the Constraint object contained as attribute in a OptObject is this OptObject
- class tests.test_optimisation_model.TestAddUnitParent(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_optimisation_model.TestCheckIfUnitCouldHaveParent(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_optimisation_model.TestGetAllUnits(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_optimisation_model.TestGetLists(methodName='runTest')[source]
Bases:
TestCaseTest quantity, constraint and objective get methods
- test_add_and_get_constraints()[source]
Test if the constraint is added into the model is available with get_constraints_name_list()
tests.test_producer_actors module
Unit tests for the module producer_actors.py, defining constraints and objectives for producer actor type.
Copyright 2018 G2Elab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_producer_actors.TestProducerActorConstraints(methodName='runTest')[source]
Bases:
TestCaseTest of ProducerActor constraints
- test_energy_production_maximum()[source]
Test the energy_production_maximum constraint on two production units
- test_energy_production_maximum_without_int_or_float()[source]
Test it raises an error if max_e_tot is a list
- test_energy_production_minimum()[source]
Test the energy_production_minimum constraint on two production units
- test_energy_production_minimum_without_int_or_float()[source]
Test it raises an error if min_e_tot is a list
- test_power_producion_total_maximum_with_dic()[source]
Test it raises an error if max_p is a list with dictionary
- test_power_production_by_unit_maximum()[source]
Test the power_production_by_unit_maximum constraint on two production units
- test_power_production_by_unit_maximum_with_dic()[source]
Test it raises an error if max_p is a list with dictionary
- test_power_production_by_unit_maximum_with_list()[source]
Test the power_production_by_unit_maximum constraint on two production units if max_p is a list
- test_power_production_by_unit_maximum_with_wrong_list()[source]
Test it raises an error if max_p is a list with a wrong dimension considering the unit time
- test_power_production_by_unit_minimum()[source]
Test the add_power_production_by_unit_minimum constraint on two production units
- test_power_production_by_unit_minimum_with_dic()[source]
Test it raises an error if min_p is a dictionary
- test_power_production_by_unit_minimum_with_list()[source]
Test the add_power_production_by_unit_minimum constraint on two production units if min_p is a list
- test_power_production_by_unit_minimum_with_wrong_list()[source]
Test it raises an error if min_p is a list with a wrong dimension considering the unit time
- test_power_production_total_maximum()[source]
Test the power_production_maximum constraint on two production units
- test_power_production_total_maximum_with_list()[source]
Test the power_production_maximum constraint on two production units if max_p is a list
- test_power_production_total_maximum_with_wrong_list()[source]
Test it raises an error if max_p is a list with a wrong dimension considering the unit time
- test_power_production_total_minimum()[source]
Test the add_power_production_minimum constraint on two production units
- test_power_production_total_minimum_with_dic()[source]
Test it raises an error if min_p is a dictionary
- class tests.test_producer_actors.TestProducerActorObjectives(methodName='runTest')[source]
Bases:
TestCaseTest of ProducerActor objectives
- test_minimize_co2_emissions()[source]
Test the minimize_co2_production objective on two production units
- test_minimize_costs()[source]
Test the minimize_costs objective considering starting and operating costs on two production units
- test_minimize_operating_costs()[source]
Test the minimize_operating_cost objective on two production units
tests.test_production_units module
Unit tests for production_units module
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_production_units.TestCalculationMethods(methodName='runTest')[source]
Bases:
TestCaseCheck the calculation methods of the ProductionUnit class
- test_def_co2_emissions_calc_float()[source]
Test the _def_co2_emissions_calc method if co2_out is a float
- test_def_co2_emissions_calc_int()[source]
Test the _def_co2_emissions_calc method if co2_out is an int
- test_def_co2_emissions_calc_list()[source]
Test the _def_co2_emissions_calc method if co2_out is a incomplete and complete list
- test_def_co2_emissions_calc_none()[source]
Test the _def_co2_emissions_calc method if co2_out is none
- test_def_co2_emissions_calc_other()[source]
Test the _def_co2_emissions_calc method if co2_out is a dictionary
- test_def_operating_cost_calc_float()[source]
Test the _def_operating_cost_calc method if operating_cost is a float
- test_def_operating_cost_calc_int()[source]
Test the _def_operating_cost_calc method if operating_cost is an int
- test_def_operating_cost_calc_list()[source]
Test the _def_operating_cost_calc method if operating_cost is a incomplete and complete list
- test_def_operating_cost_calc_none()[source]
Test the _def_operating_cost_calc method if operating_cost is none
- test_def_operating_cost_calc_other()[source]
Test the _def_operating_cost_calc method if operating_cost is a dictionary
- class tests.test_production_units.TestFixedProductionUnit(methodName='runTest')[source]
Bases:
TestCaseCheck the FixedProductionUnit class
- class tests.test_production_units.TestObjectives(methodName='runTest')[source]
Bases:
TestCaseTest the objective methods
- class tests.test_production_units.TestQuantitiesAndConstraints(methodName='runTest')[source]
Bases:
TestCaseCheck the initialisation of the ProductionUnit class
- class tests.test_production_units.TestSeveralProductionUnit(methodName='runTest')[source]
Bases:
TestCaseCheck the SeveralProductionUnit class
- class tests.test_production_units.TestShiftableProductionUnit(methodName='runTest')[source]
Bases:
TestCaseCheck the ShiftableProductionUnit class
- set_energy_limits_on_time_period_mandatory_false()[source]
Test the quantity created by the set_energy_limits_on_time_period method, and the emin definition
- class tests.test_production_units.TestSquareProductionUnit(methodName='runTest')[source]
Bases:
TestCaseCheck the SquareProductionUnit class
- class tests.test_production_units.TestTheConstraintsMethods(methodName='runTest')[source]
Bases:
TestCaseCheck the constraint methods of the ProductionUnit class
- test_def_availability_cst_none()[source]
Test the _def_availability_cst method if availability_hours is none
- test_def_availability_cst_not_none()[source]
Test the _def_availability_cst method if availability_hours is not none
- test_def_max_ramp_down_cst_none()[source]
Test the _def_max_ramp_down_cst method if set_max_ramp_down is none
- test_def_max_ramp_down_cst_not_none()[source]
Test the _def_max_ramp_down_cst method if set_max_ramp_down is not none
- test_def_max_ramp_up_cst_none()[source]
Test the _def_max_ramp_up_cst method if set_max_ramp_up is none
- test_def_max_ramp_up_cst_not_none()[source]
Test the _def_max_ramp_up_cst method if set_max_ramp_up is not none
- test_def_min_down_time_cst_none()[source]
Test the _def_min_down_time_cst method if set_min_down_time is none
- test_def_min_down_time_cst_not_none()[source]
Test the _def_min_down_time_cst method if set_min_down_time is not none
tests.test_regulator_actors module
Unit tests for the module regulator_actors.py, defining regulator actor classes and constraints for regulator actors.
Copyright 2018 G2Elab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_regulator_actors.TestRegulatorActor(methodName='runTest')[source]
Bases:
TestCaseTest of RegulatorActor constraint
- test_co2_emission_maximum()[source]
Test the co2_emission_maximum constraint on two production units
- test_co2_emission_maximum_with_list()[source]
Test the co2_emission_maximum constraint on two production units if max_co2 is a list
tests.test_reversible_units module
Unit tests for the module reversible_units.py, defining the reversible units attributes, constraints and functions.
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_reversible_units.TestRevUnit(methodName='runTest')[source]
Bases:
TestCase- test_def_rev_cons()[source]
Asserting the def_rev constraint (non-simultaneity constraint) is properly defined with fixed consumption unit
- test_def_rev_prod()[source]
Asserting the def_rev constraint (non-simultaneity constraint) is properly defined with fixed production unit
tests.test_storage_design module
” Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_storage_design.TestStorageDesign(methodName='runTest')[source]
Bases:
TestCaseUnittests for the example storage_design.py
- test_capacity_result()[source]
Check if the capacity results with the defined parameters is the right solution
- test_load_profile_creation()[source]
Check if the load profile is taken into account for power values
tests.test_storage_units module
Unit tests for the module storage_units.py, defining the storage units attributes, constraints and functions.
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_storage_units.TestCyclesWrong(methodName='runTest')[source]
Bases:
TestCaseAsserting an error is raised when cycles is not an int
- class tests.test_storage_units.TestSelfDisch(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_storage_units.TestStorageUnitInit(methodName='runTest')[source]
Bases:
TestCaseChecking the initialisation of the StorageUnit class
- test_SOC_error_list()[source]
Asserting an error is raised when SOCmin > SOCmax for all time instants
- class tests.test_storage_units.TestThermoclineStorageSocMax(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_storage_units.Test_e_f(methodName='runTest')[source]
Bases:
TestCase- test_e_f_SOC_float()[source]
Checking e_f boundary constraints are properly set when floats and deactivate it when ef is not none
tests.test_time module
Unittests for the module time.py, defining the time units class of the models
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_time.TestConvertEuropeanFormat(methodName='runTest')[source]
Bases:
TestCase
- class tests.test_time.TestGetDateForIndex(methodName='runTest')[source]
Bases:
TestCase- test_get_date_for_index_dict()[source]
Checking the get_date_for index function raises an Error when asked a dict index
- test_get_date_for_index_float()[source]
Checking the get_date_for index function raises an Error when asked a float index
- test_get_date_for_index_int()[source]
Checking the get_date_for index function return the right date
- test_get_date_for_index_list()[source]
Checking the get_date_for index function raises an Error when asked a list index
- class tests.test_time.TestGetIndexForDateRange(methodName='runTest')[source]
Bases:
TestCase
tests.test_waste_heat_recovery module
“
Copyright 2018 G2ELab / MAGE
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class tests.test_waste_heat_recovery.TestWasteHeatRecoverySystem(methodName='runTest')[source]
Bases:
TestCaseUnittests for the example waste_heat_recovery.py
- test_file_cons()[source]
Checking the text file for the district heat load consumption is properly taken into account