From d5f9ae33d79d68d1310561265daf88e889fdb89c Mon Sep 17 00:00:00 2001 From: Jeff Curtis Date: Mon, 27 Oct 2025 12:06:22 -0500 Subject: [PATCH] add test for aero_background --- src/pypartmc.cpp | 2 +- src/scenario.hpp | 2 +- tests/test_scenario.py | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pypartmc.cpp b/src/pypartmc.cpp index c758a2a0..2261706a 100644 --- a/src/pypartmc.cpp +++ b/src/pypartmc.cpp @@ -471,7 +471,7 @@ NB_MODULE(_PyPartMC, m) { "Return a string with JSON representation of the object.") .def("init_env_state", Scenario::init_env_state, "Initialize the EnvState.") - .def("aero_emissions", Scenario::get_dist, + .def("aero_emissions", Scenario::get_aero_emission_dist, "Return aero_emissions AeroDists at a given index.") .def_prop_ro("aero_emissions_n_times", Scenario::get_emissions_n_times, "Return the number of times specified for emissions.") diff --git a/src/scenario.hpp b/src/scenario.hpp index 8ba25b69..9a3f2095 100644 --- a/src/scenario.hpp +++ b/src/scenario.hpp @@ -148,7 +148,7 @@ struct Scenario { ); } - static AeroDist* get_dist(const Scenario &self, const AeroData &aero_data, const int &idx) { + static AeroDist* get_aero_emission_dist(const Scenario &self, const AeroData &aero_data, const int &idx) { // if (idx < 0 || idx >= AeroDist::get_n_mode(self)) // throw std::out_of_range("Index out of range"); AeroDist *ptr = new AeroDist(); diff --git a/tests/test_scenario.py b/tests/test_scenario.py index 98701044..1fdda6c2 100644 --- a/tests/test_scenario.py +++ b/tests/test_scenario.py @@ -201,7 +201,12 @@ def test_multi_mode(mode_names): emissions.mode(i).name for i in range(emissions.n_mode) ) assert mode_names == actual_mode_names - # TODO #223 : same for background + + background = sut.aero_background(aero_data, 0) + actual_mode_names = tuple( + background.mode(i).name for i in range(background.n_mode) + ) + assert mode_names == actual_mode_names @staticmethod @pytest.mark.parametrize("key", ("aero_emissions", "aero_background"))