diff --git a/tests/core/test_optimization_equation.py b/tests/core/test_optimization_equation.py index 56945d97..67b2fc1c 100644 --- a/tests/core/test_optimization_equation.py +++ b/tests/core/test_optimization_equation.py @@ -90,12 +90,12 @@ def test_create_equation(self, platform: ixmp4.Platform): ) # Test column.dtype is registered correctly - indexset_2.add(elements=2024) + indexset_2.add(data=2024) equation_3 = run.optimization.equations.create( "Equation 5", constrained_to_indexsets=[indexset.name, indexset_2.name], ) - # If indexset doesn't have elements, a generic dtype is registered + # If indexset doesn't have data, a generic dtype is registered assert equation_3.columns[0].dtype == "object" assert equation_3.columns[1].dtype == "int64" @@ -126,8 +126,8 @@ def test_equation_add_data(self, platform: ixmp4.Platform): IndexSet(_backend=platform.backend, _model=model) for model in create_indexsets_for_run(platform=platform, run_id=run.id) ) - indexset.add(elements=["foo", "bar", ""]) - indexset_2.add(elements=[1, 2, 3]) + indexset.add(data=["foo", "bar", ""]) + indexset_2.add(data=[1, 2, 3]) # pandas can only convert dicts to dataframes if the values are lists # or if index is given. But maybe using read_json instead of from_dict # can remedy this. Or maybe we want to catch the resulting @@ -251,7 +251,7 @@ def test_equation_add_data(self, platform: ixmp4.Platform): def test_equation_remove_data(self, platform: ixmp4.Platform): run = platform.runs.create("Model", "Scenario") indexset = run.optimization.indexsets.create("Indexset") - indexset.add(elements=["foo", "bar"]) + indexset.add(data=["foo", "bar"]) test_data = { "Indexset": ["bar", "foo"], "levels": [2.0, 1], @@ -326,8 +326,8 @@ def test_tabulate_equation(self, platform: ixmp4.Platform): run.optimization.equations.tabulate(name="Equation 2"), ) - indexset.add(elements=["foo", "bar"]) - indexset_2.add(elements=[1, 2, 3]) + indexset.add(data=["foo", "bar"]) + indexset_2.add(data=[1, 2, 3]) test_data_1 = { indexset.name: ["foo"], indexset_2.name: [1], diff --git a/tests/core/test_optimization_parameter.py b/tests/core/test_optimization_parameter.py index 8602ddf1..f6baed9d 100644 --- a/tests/core/test_optimization_parameter.py +++ b/tests/core/test_optimization_parameter.py @@ -90,12 +90,12 @@ def test_create_parameter(self, platform: ixmp4.Platform): ) # Test column.dtype is registered correctly - indexset_2.add(elements=2024) + indexset_2.add(data=2024) parameter_3 = run.optimization.parameters.create( "Parameter 5", constrained_to_indexsets=[indexset.name, indexset_2.name], ) - # If indexset doesn't have elements, a generic dtype is registered + # If indexset doesn't have data, a generic dtype is registered assert parameter_3.columns[0].dtype == "object" assert parameter_3.columns[1].dtype == "int64" @@ -127,8 +127,8 @@ def test_parameter_add_data(self, platform: ixmp4.Platform): IndexSet(_backend=platform.backend, _model=model) for model in create_indexsets_for_run(platform=platform, run_id=run.id) ) - indexset.add(elements=["foo", "bar", ""]) - indexset_2.add(elements=[1, 2, 3]) + indexset.add(data=["foo", "bar", ""]) + indexset_2.add(data=[1, 2, 3]) # pandas can only convert dicts to dataframes if the values are lists # or if index is given. But maybe using read_json instead of from_dict # can remedy this. Or maybe we want to catch the resulting @@ -308,8 +308,8 @@ def test_tabulate_parameter(self, platform: ixmp4.Platform): unit = platform.units.create("Unit") unit_2 = platform.units.create("Unit 2") - indexset.add(elements=["foo", "bar"]) - indexset_2.add(elements=[1, 2, 3]) + indexset.add(data=["foo", "bar"]) + indexset_2.add(data=[1, 2, 3]) test_data_1 = { indexset.name: ["foo"], indexset_2.name: [1], diff --git a/tests/core/test_optimization_table.py b/tests/core/test_optimization_table.py index 57110950..93f0c03e 100644 --- a/tests/core/test_optimization_table.py +++ b/tests/core/test_optimization_table.py @@ -90,12 +90,12 @@ def test_create_table(self, platform: ixmp4.Platform): ) # Test column.dtype is registered correctly - indexset_2.add(elements=2024) + indexset_2.add(data=2024) table_3 = run.optimization.tables.create( "Table 5", constrained_to_indexsets=[indexset.name, indexset_2.name], ) - # If indexset doesn't have elements, a generic dtype is registered + # If indexset doesn't have data, a generic dtype is registered assert table_3.columns[0].dtype == "object" assert table_3.columns[1].dtype == "int64" @@ -124,7 +124,7 @@ def test_table_add_data(self, platform: ixmp4.Platform): IndexSet(_backend=platform.backend, _model=model) # type: ignore for model in create_indexsets_for_run(platform=platform, run_id=run.id) ) - indexset.add(elements=["foo", "bar", ""]) + indexset.add(data=["foo", "bar", ""]) indexset_2.add([1, 2, 3]) # pandas can only convert dicts to dataframes if the values are lists # or if index is given. But maybe using read_json instead of from_dict @@ -224,9 +224,9 @@ def test_table_add_data(self, platform: ixmp4.Platform): indexset_3 = run.optimization.indexsets.create(name="Indexset 3") test_data_5 = { indexset.name: ["foo", "foo", "bar"], - indexset_3.name: [1, "2", 3.14], + indexset_3.name: [1.0, 2.2, 3.14], } - indexset_3.add(elements=[1, "2", 3.14]) + indexset_3.add(data=[1.0, 2.2, 3.14]) table_5 = run.optimization.tables.create( name="Table 5", constrained_to_indexsets=[indexset.name, indexset_3.name], diff --git a/tests/core/test_optimization_variable.py b/tests/core/test_optimization_variable.py index 0cd096b5..560b4783 100644 --- a/tests/core/test_optimization_variable.py +++ b/tests/core/test_optimization_variable.py @@ -113,12 +113,12 @@ def test_create_variable(self, platform: ixmp4.Platform): ) # Test column.dtype is registered correctly - indexset_2.add(elements=2024) + indexset_2.add(data=2024) variable_4 = run.optimization.variables.create( "Variable 4", constrained_to_indexsets=[indexset.name, indexset_2.name], ) - # If indexset doesn't have elements, a generic dtype is registered + # If indexset doesn't have data, a generic dtype is registered assert variable_4.columns is not None assert variable_4.columns[0].dtype == "object" assert variable_4.columns[1].dtype == "int64" @@ -151,8 +151,8 @@ def test_variable_add_data(self, platform: ixmp4.Platform): IndexSet(_backend=platform.backend, _model=model) for model in create_indexsets_for_run(platform=platform, run_id=run.id) ) - indexset.add(elements=["foo", "bar", ""]) - indexset_2.add(elements=[1, 2, 3]) + indexset.add(data=["foo", "bar", ""]) + indexset_2.add(data=[1, 2, 3]) # pandas can only convert dicts to dataframes if the values are lists # or if index is given. But maybe using read_json instead of from_dict # can remedy this. Or maybe we want to catch the resulting @@ -276,7 +276,7 @@ def test_variable_add_data(self, platform: ixmp4.Platform): def test_variable_remove_data(self, platform: ixmp4.Platform): run = platform.runs.create("Model", "Scenario") indexset = run.optimization.indexsets.create("Indexset") - indexset.add(elements=["foo", "bar"]) + indexset.add(data=["foo", "bar"]) test_data = { "Indexset": ["bar", "foo"], "levels": [2.0, 1], @@ -349,8 +349,8 @@ def test_tabulate_variable(self, platform: ixmp4.Platform): run.optimization.variables.tabulate(name="Variable 2"), ) - indexset.add(elements=["foo", "bar"]) - indexset_2.add(elements=[1, 2, 3]) + indexset.add(data=["foo", "bar"]) + indexset_2.add(data=[1, 2, 3]) test_data_1 = { indexset.name: ["foo"], indexset_2.name: [1], diff --git a/tests/data/test_optimization_equation.py b/tests/data/test_optimization_equation.py index b82df865..48aa29ae 100644 --- a/tests/data/test_optimization_equation.py +++ b/tests/data/test_optimization_equation.py @@ -91,9 +91,7 @@ def test_create_equation(self, platform: ixmp4.Platform): ) # Test column.dtype is registered correctly - platform.backend.optimization.indexsets.add_elements( - indexset_2.id, elements=2024 - ) + platform.backend.optimization.indexsets.add_data(indexset_2.id, data=2024) indexset_2 = platform.backend.optimization.indexsets.get( run.id, indexset_2.name ) @@ -102,7 +100,7 @@ def test_create_equation(self, platform: ixmp4.Platform): name="Equation 5", constrained_to_indexsets=[indexset.name, indexset_2.name], ) - # If indexset doesn't have elements, a generic dtype is registered + # If indexset doesn't have data, a generic dtype is registered assert equation_3.columns[0].dtype == "object" assert equation_3.columns[1].dtype == "int64" @@ -128,11 +126,11 @@ def test_equation_add_data(self, platform: ixmp4.Platform): indexset, indexset_2 = create_indexsets_for_run( platform=platform, run_id=run.id ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset.id, elements=["foo", "bar", ""] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset.id, data=["foo", "bar", ""] ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_2.id, elements=[1, 2, 3] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_2.id, data=[1, 2, 3] ) # pandas can only convert dicts to dataframes if the values are lists # or if index is given. But maybe using read_json instead of from_dict @@ -280,8 +278,8 @@ def test_equation_remove_data(self, platform: ixmp4.Platform): (indexset,) = create_indexsets_for_run( platform=platform, run_id=run.id, amount=1 ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset.id, elements=["foo", "bar"] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset.id, data=["foo", "bar"] ) test_data = { indexset.name: ["bar", "foo"], @@ -363,11 +361,11 @@ def test_tabulate_equation(self, platform: ixmp4.Platform): platform.backend.optimization.equations.tabulate(name="Equation 2"), ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset.id, elements=["foo", "bar"] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset.id, data=["foo", "bar"] ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_2.id, elements=[1, 2, 3] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_2.id, data=[1, 2, 3] ) test_data_1 = { indexset.name: ["foo"], diff --git a/tests/data/test_optimization_parameter.py b/tests/data/test_optimization_parameter.py index dac17e86..7993596f 100644 --- a/tests/data/test_optimization_parameter.py +++ b/tests/data/test_optimization_parameter.py @@ -93,9 +93,7 @@ def test_create_parameter(self, platform: ixmp4.Platform): ) # Test column.dtype is registered correctly - platform.backend.optimization.indexsets.add_elements( - indexset_2.id, elements=2024 - ) + platform.backend.optimization.indexsets.add_data(indexset_2.id, data=2024) indexset_2 = platform.backend.optimization.indexsets.get( run.id, indexset_2.name ) @@ -104,7 +102,7 @@ def test_create_parameter(self, platform: ixmp4.Platform): name="Parameter 5", constrained_to_indexsets=[indexset.name, indexset_2.name], ) - # If indexset doesn't have elements, a generic dtype is registered + # If indexset doesn't have data, a generic dtype is registered assert parameter_3.columns[0].dtype == "object" assert parameter_3.columns[1].dtype == "int64" @@ -129,11 +127,11 @@ def test_parameter_add_data(self, platform: ixmp4.Platform): indexset, indexset_2 = create_indexsets_for_run( platform=platform, run_id=run.id ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset.id, elements=["foo", "bar", ""] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset.id, data=["foo", "bar", ""] ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_2.id, elements=[1, 2, 3] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_2.id, data=[1, 2, 3] ) # pandas can only convert dicts to dataframes if the values are lists # or if index is given. But maybe using read_json instead of from_dict @@ -348,11 +346,11 @@ def test_tabulate_parameter(self, platform: ixmp4.Platform): unit = platform.backend.units.create("Unit") unit_2 = platform.backend.units.create("Unit 2") - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset.id, elements=["foo", "bar"] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset.id, data=["foo", "bar"] ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_2.id, elements=[1, 2, 3] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_2.id, data=[1, 2, 3] ) test_data_1 = { indexset.name: ["foo"], diff --git a/tests/data/test_optimization_table.py b/tests/data/test_optimization_table.py index f4643da7..5db61cc6 100644 --- a/tests/data/test_optimization_table.py +++ b/tests/data/test_optimization_table.py @@ -89,9 +89,7 @@ def test_create_table(self, platform: ixmp4.Platform): ) # Test column.dtype is registered correctly - platform.backend.optimization.indexsets.add_elements( - indexset_2.id, elements=2024 - ) + platform.backend.optimization.indexsets.add_data(indexset_2.id, data=2024) indexset_2 = platform.backend.optimization.indexsets.get( run.id, indexset_2.name ) @@ -100,7 +98,7 @@ def test_create_table(self, platform: ixmp4.Platform): name="Table 5", constrained_to_indexsets=[indexset_1.name, indexset_2.name], ) - # If indexset doesn't have elements, a generic dtype is registered + # If indexset doesn't have data, a generic dtype is registered assert table_3.columns[0].dtype == "object" assert table_3.columns[1].dtype == "int64" @@ -122,11 +120,11 @@ def test_table_add_data(self, platform: ixmp4.Platform): indexset_1, indexset_2 = create_indexsets_for_run( platform=platform, run_id=run.id ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_1.id, elements=["foo", "bar", ""] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_1.id, data=["foo", "bar", ""] ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_2.id, elements=[1, 2, 3] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_2.id, data=[1, 2, 3] ) # pandas can only convert dicts to dataframes if the values are lists # or if index is given. But maybe using read_json instead of from_dict @@ -268,11 +266,11 @@ def test_table_add_data(self, platform: ixmp4.Platform): ) test_data_5 = { indexset_1.name: ["foo", "foo", "bar"], - indexset_3.name: [1, "2", 3.14], + indexset_3.name: [1.0, 2.2, 3.14], } - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_3.id, elements=[1, "2", 3.14] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_3.id, data=[1.0, 2.2, 3.14] ) table_5 = platform.backend.optimization.tables.create( run_id=run.id, @@ -341,11 +339,11 @@ def test_tabulate_table(self, platform: ixmp4.Platform): platform.backend.optimization.tables.tabulate(name="Table 2"), ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_1.id, elements=["foo", "bar"] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_1.id, data=["foo", "bar"] ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_2.id, elements=[1, 2, 3] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_2.id, data=[1, 2, 3] ) test_data_1 = {indexset_1.name: ["foo"], indexset_2.name: [1]} platform.backend.optimization.tables.add_data( diff --git a/tests/data/test_optimization_variable.py b/tests/data/test_optimization_variable.py index ff8f3012..0c61ea72 100644 --- a/tests/data/test_optimization_variable.py +++ b/tests/data/test_optimization_variable.py @@ -114,9 +114,7 @@ def test_create_variable(self, platform: ixmp4.Platform): ) # Test column.dtype is registered correctly - platform.backend.optimization.indexsets.add_elements( - indexset_2.id, elements=2024 - ) + platform.backend.optimization.indexsets.add_data(indexset_2.id, data=2024) indexset_2 = platform.backend.optimization.indexsets.get( run.id, indexset_2.name ) @@ -125,7 +123,7 @@ def test_create_variable(self, platform: ixmp4.Platform): name="Variable 4", constrained_to_indexsets=[indexset.name, indexset_2.name], ) - # If indexset doesn't have elements, a generic dtype is registered + # If indexset doesn't have data, a generic dtype is registered assert variable_4.columns is not None assert variable_4.columns[0].dtype == "object" assert variable_4.columns[1].dtype == "int64" @@ -152,11 +150,11 @@ def test_variable_add_data(self, platform: ixmp4.Platform): indexset, indexset_2 = create_indexsets_for_run( platform=platform, run_id=run.id ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset.id, elements=["foo", "bar", ""] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset.id, data=["foo", "bar", ""] ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_2.id, elements=[1, 2, 3] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_2.id, data=[1, 2, 3] ) # pandas can only convert dicts to dataframes if the values are lists # or if index is given. But maybe using read_json instead of from_dict @@ -302,8 +300,8 @@ def test_variable_add_data(self, platform: ixmp4.Platform): def test_variable_remove_data(self, platform: ixmp4.Platform): run = platform.backend.runs.create("Model", "Scenario") indexset = platform.backend.optimization.indexsets.create(run.id, "Indexset") - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset.id, elements=["foo", "bar"] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset.id, data=["foo", "bar"] ) test_data = { "Indexset": ["bar", "foo"], @@ -383,11 +381,11 @@ def test_tabulate_variable(self, platform: ixmp4.Platform): platform.backend.optimization.variables.tabulate(name="Variable 2"), ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset.id, elements=["foo", "bar"] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset.id, data=["foo", "bar"] ) - platform.backend.optimization.indexsets.add_elements( - indexset_id=indexset_2.id, elements=[1, 2, 3] + platform.backend.optimization.indexsets.add_data( + indexset_id=indexset_2.id, data=[1, 2, 3] ) test_data_1 = { indexset.name: ["foo"],