Skip to content

Commit 96d54c8

Browse files
jcurtis2slayoo
andauthored
Add missing test for aero_background (#459)
Co-authored-by: Sylwester Arabas <sylwester.arabas@agh.edu.pl>
1 parent ea08af2 commit 96d54c8

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/pypartmc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ NB_MODULE(_PyPartMC, m) {
471471
"Return a string with JSON representation of the object.")
472472
.def("init_env_state", Scenario::init_env_state,
473473
"Initialize the EnvState.")
474-
.def("aero_emissions", Scenario::get_dist,
474+
.def("aero_emissions", Scenario::get_aero_emission_dist,
475475
"Return aero_emissions AeroDists at a given index.")
476476
.def_prop_ro("aero_emissions_n_times", Scenario::get_emissions_n_times,
477477
"Return the number of times specified for emissions.")

src/scenario.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ struct Scenario {
148148
);
149149
}
150150

151-
static AeroDist* get_dist(const Scenario &self, const AeroData &aero_data, const int &idx) {
151+
static AeroDist* get_aero_emission_dist(const Scenario &self, const AeroData &aero_data, const int &idx) {
152152
// if (idx < 0 || idx >= AeroDist::get_n_mode(self))
153153
// throw std::out_of_range("Index out of range");
154154
AeroDist *ptr = new AeroDist();

tests/test_scenario.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ def test_multi_mode(mode_names):
201201
emissions.mode(i).name for i in range(emissions.n_mode)
202202
)
203203
assert mode_names == actual_mode_names
204-
# TODO #223 : same for background
204+
205+
background = sut.aero_background(aero_data, 0)
206+
actual_mode_names = tuple(
207+
background.mode(i).name for i in range(background.n_mode)
208+
)
209+
assert mode_names == actual_mode_names
205210

206211
@staticmethod
207212
@pytest.mark.parametrize("key", ("aero_emissions", "aero_background"))

0 commit comments

Comments
 (0)