From 037d509b9f78233b306e13d11f331fe80762e746 Mon Sep 17 00:00:00 2001 From: Johannes Roeder Date: Tue, 18 Apr 2023 10:43:24 +0200 Subject: [PATCH 1/5] Fix pandas future warning --- dhnx/simulation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dhnx/simulation.py b/dhnx/simulation.py index b01e3c5b..b08dd698 100644 --- a/dhnx/simulation.py +++ b/dhnx/simulation.py @@ -190,7 +190,7 @@ def _concat_scalars(self, name): ] if select_scalars: - select_scalars = pd.concat(select_scalars, 0) + select_scalars = pd.concat(select_scalars, axis=0) else: select_scalars = None From de17e9895ccc65dbb82a32e0d31655650778f78b Mon Sep 17 00:00:00 2001 From: Johannes Roeder Date: Tue, 18 Apr 2023 11:00:18 +0200 Subject: [PATCH 2/5] Fix pandas warnings --- dhnx/simulation.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dhnx/simulation.py b/dhnx/simulation.py index b08dd698..9790331e 100644 --- a/dhnx/simulation.py +++ b/dhnx/simulation.py @@ -217,7 +217,7 @@ def _concat_sequences(self, name): if name in d ] - concat_sequences = pd.concat(select_sequences, 1) + concat_sequences = pd.concat(select_sequences, axis=1) return concat_sequences @@ -652,8 +652,9 @@ def _calculate_pump_power(self, global_pressure_losses): if data['component_type'] == 'Producer' ] - mass_flow_producers = \ - self.results['pipes-mass_flow'].loc[:, idx[producers, :]].sum(axis=1) + mass_flow_producers = self.results['pipes-mass_flow'].iloc[:, + self.results['pipes-mass_flow'].columns.isin( + producers, level=0)].sum(axis=1) pump_power = mass_flow_producers * global_pressure_losses / (self.eta_pump * self.rho) From 245a3a0640687cf281594e82c5306b0996c32866 Mon Sep 17 00:00:00 2001 From: Johannes Roeder Date: Tue, 18 Apr 2023 13:25:11 +0200 Subject: [PATCH 3/5] Add todo warning simulation tests --- docs/whatsnew/v0-0-3.rst | 3 ++- tests/helpers.py | 2 ++ tests/test_results.py | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/whatsnew/v0-0-3.rst b/docs/whatsnew/v0-0-3.rst index 4ef34d41..44a24ac7 100644 --- a/docs/whatsnew/v0-0-3.rst +++ b/docs/whatsnew/v0-0-3.rst @@ -36,7 +36,8 @@ Bug fixes Known issues ^^^^^^^^^^^^^^^^^^^^ -* something +* Simulation tests do not test, as check_if_csv_files_equal + from helpers module is incomplete. Testing diff --git a/tests/helpers.py b/tests/helpers.py index 4f8ac1bc..7ae60de4 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -51,6 +51,8 @@ def check_if_csv_files_equal(csv_file_a, csv_file_b, check_arrays=False, **kwarg r""" Compares two csv files. + TODO: Check not working. Nothing happens, if check fails! + Parameters ---------- csv_file_a : str diff --git a/tests/test_results.py b/tests/test_results.py index 9c1e48da..f0979a8c 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -12,6 +12,8 @@ def test_tree_simulation(): + # TODO: Test not working! Nothing happens, if check fails! + input_data = os.path.join( tests_path, '_files', @@ -46,6 +48,8 @@ def test_tree_simulation(): def test_tree_simulation_reverse_pipe_dir(): + # TODO: Test not working! Nothing happens, if check fails! + input_data = os.path.join( tests_path, '_files', From d9320d0be27cea802b23134466659c3aa5021534 Mon Sep 17 00:00:00 2001 From: Johannes Roeder Date: Tue, 18 Apr 2023 13:40:13 +0200 Subject: [PATCH 4/5] Fix flake8 --- dhnx/simulation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dhnx/simulation.py b/dhnx/simulation.py index 9790331e..2e0409b5 100644 --- a/dhnx/simulation.py +++ b/dhnx/simulation.py @@ -652,8 +652,8 @@ def _calculate_pump_power(self, global_pressure_losses): if data['component_type'] == 'Producer' ] - mass_flow_producers = self.results['pipes-mass_flow'].iloc[:, - self.results['pipes-mass_flow'].columns.isin( + mass_flow_producers = self.results['pipes-mass_flow'].iloc[ + :, self.results['pipes-mass_flow'].columns.isin( producers, level=0)].sum(axis=1) pump_power = mass_flow_producers * global_pressure_losses / (self.eta_pump * self.rho) From 23f72d04c8d28f8fdb807adcb90e38d4697948ee Mon Sep 17 00:00:00 2001 From: Johannes Roeder Date: Tue, 18 Apr 2023 13:42:07 +0200 Subject: [PATCH 5/5] Remove coverage from gh workflow --- .github/workflows/tox_pytests.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/tox_pytests.yml b/.github/workflows/tox_pytests.yml index 141b4101..56f113f0 100644 --- a/.github/workflows/tox_pytests.yml +++ b/.github/workflows/tox_pytests.yml @@ -34,12 +34,3 @@ jobs: pip install tox tox-gh-actions coverage coveralls - name: Test with tox run: tox - - - name: Check test coverage - run: coverage report -m --fail-under=${{ matrix.vcs == 'bzr' && 24 || 25 }} - - - name: Report to coveralls - run: coveralls - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_SERVICE_NAME: github