diff --git a/.github/workflows/tests+artifacts+pypi.yml b/.github/workflows/tests+artifacts+pypi.yml index 2bdc5719e..e4c000913 100644 --- a/.github/workflows/tests+artifacts+pypi.yml +++ b/.github/workflows/tests+artifacts+pypi.yml @@ -67,7 +67,7 @@ jobs: persist-credentials: false - uses: actions/setup-python@v5.0.0 with: - python-version: 3.9 + python-version: "3.12" - run: | pip install pdoc nbformat pip install -e . @@ -131,7 +131,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-13, macos-14, windows-latest] - python-version: ["3.9", "3.11"] + python-version: ["3.9", "3.12"] test-suite: ["unit_tests/!(dynamics)", "unit_tests/dynamics/!(condensation)", "unit_tests/dynamics/condensation", "smoke_tests/no_env", "smoke_tests/box", "smoke_tests/parcel_a", "smoke_tests/parcel_b", "smoke_tests/parcel_c", "smoke_tests/kinematic_1d", "smoke_tests/kinematic_2d", "tutorials_tests"] exclude: - platform: "macos-14" @@ -197,7 +197,7 @@ jobs: strategy: matrix: platform: [ubuntu-24.04, macos-13, windows-latest] - python-version: ["3.9", "3.11"] + python-version: ["3.9", "3.12"] runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v4.1.6 @@ -233,7 +233,7 @@ jobs: strategy: matrix: platform: [ubuntu-24.04, macos-13, windows-latest] - python-version: ["3.9", "3.11"] + python-version: ["3.9", "3.12"] test-suite: [ "chemistry_freezing_isotopes", "condensation_a", "condensation_b", "coagulation", "breakup", "multi-process_a", "multi-process_b"] fail-fast: false runs-on: ${{ matrix.platform }} @@ -318,7 +318,7 @@ jobs: fetch-depth: 0 # https://github.com/pypa/setuptools_scm/issues/480 - uses: actions/setup-python@v5.0.0 with: - python-version: "3.11" + python-version: "3.12" - run: pip install twine build @@ -326,7 +326,11 @@ jobs: unset CI cd ${{ matrix.packages-dir }} python -m build 2>&1 | tee build.log - exit `fgrep -i warning build.log | grep -v impl_numba/warnings.py | grep -v "no previously-included files matching" | wc -l` + exit `fgrep -i warning build.log | grep -v impl_numba/warnings.py \ + | grep -v "no previously-included files matching" \ + | grep -v "version of {dist_name} already set" \ + | grep -v -E "UserWarning: version of PySDM(-examples)? already set" \ + | wc -l` twine check --strict dist/* - uses: actions/upload-artifact@v4 @@ -338,7 +342,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-13, macos-14, windows-latest] - python-version: ["3.9", "3.11"] + python-version: ["3.9", "3.12"] exclude: - platform: macos-14 python-version: "3.9" diff --git a/examples/PySDM_examples/Kreidenweis_et_al_2003/simulation.py b/examples/PySDM_examples/Kreidenweis_et_al_2003/simulation.py index b7f186230..c498e1f3d 100644 --- a/examples/PySDM_examples/Kreidenweis_et_al_2003/simulation.py +++ b/examples/PySDM_examples/Kreidenweis_et_al_2003/simulation.py @@ -114,7 +114,7 @@ def __init__(self, settings, products=None): key="S_VI", dry_radius_bins_edges=settings.dry_radius_bins_edges, name="dm_S_VI/dlog_10(dry diameter)", - unit='ug / m^3"', + unit="ug / m^3", ), ) diff --git a/examples/PySDM_examples/Srivastava_1982/simulation.py b/examples/PySDM_examples/Srivastava_1982/simulation.py index 3af7ea1fd..3e8746961 100644 --- a/examples/PySDM_examples/Srivastava_1982/simulation.py +++ b/examples/PySDM_examples/Srivastava_1982/simulation.py @@ -70,7 +70,7 @@ def run_convergence_analysis(self, x, seeds): if step != 0: particulator.run(steps=1) for prod in self.settings.prods: - self.simulation_res[n_sd][prod][seed][step] = ( + (self.simulation_res[n_sd][prod][seed][step],) = ( particulator.products[prod].get() ) diff --git a/examples/PySDM_examples/deJong_Azimi/simulation_0D.py b/examples/PySDM_examples/deJong_Azimi/simulation_0D.py index e867913ce..671700b01 100644 --- a/examples/PySDM_examples/deJong_Azimi/simulation_0D.py +++ b/examples/PySDM_examples/deJong_Azimi/simulation_0D.py @@ -48,9 +48,9 @@ def run_box(settings, backend_class=CPU): for i, step in enumerate(settings.steps): particulator.run(step - particulator.n_steps) y[i] = particulator.products["dv/dlnr"].get()[0] - mom[i, 0] = particulator.products["M0"].get() - mom[i, 1] = particulator.products["M1"].get() - mom[i, 2] = particulator.products["M2"].get() + (mom[i, 0],) = particulator.products["M0"].get() + (mom[i, 1],) = particulator.products["M1"].get() + (mom[i, 2],) = particulator.products["M2"].get() return namedtuple("_", ("radius_bins_left_edges", "dv_dlnr", "moments"))( radius_bins_left_edges=settings.radius_bins_edges[:-1], dv_dlnr=y, moments=mom diff --git a/examples/PySDM_examples/deJong_Mackay_et_al_2023/simulation_0D.py b/examples/PySDM_examples/deJong_Mackay_et_al_2023/simulation_0D.py index 220674a93..4ee8249f3 100644 --- a/examples/PySDM_examples/deJong_Mackay_et_al_2023/simulation_0D.py +++ b/examples/PySDM_examples/deJong_Mackay_et_al_2023/simulation_0D.py @@ -79,11 +79,11 @@ def run_box_breakup( core.run(step - core.n_steps) y[i] = core.products["dv/dlnr"].get()[0] if return_nv: - y2[i] = core.products["N(v)"].get()[0] - rates[i, 0] = core.products["cr"].get() - rates[i, 1] = core.products["crd"].get() - rates[i, 2] = core.products["cor"].get() - rates[i, 3] = core.products["br"].get() + (y2[i],) = core.products["N(v)"].get() + (rates[i, 0],) = core.products["cr"].get() + (rates[i, 1],) = core.products["crd"].get() + (rates[i, 2],) = core.products["cor"].get() + (rates[i, 3],) = core.products["br"].get() x = (settings.radius_bins_edges[:-1] / si.micrometres,)[0] @@ -124,10 +124,10 @@ def run_box_NObreakup(settings, steps=None, backend_class=CPU): # run for i, step in enumerate(steps): core.run(step - core.n_steps) - y[i] = core.products["dv/dlnr"].get()[0] - rates[i, 0] = core.products["cr"].get() - rates[i, 1] = core.products["crd"].get() - rates[i, 2] = core.products["cor"].get() + (y[i],) = core.products["dv/dlnr"].get() + (rates[i, 0],) = core.products["cr"].get() + (rates[i, 1],) = core.products["crd"].get() + (rates[i, 2],) = core.products["cor"].get() x = (settings.radius_bins_edges[:-1] / si.micrometres,)[0] diff --git a/examples/PySDM_examples/seeding/simulation.py b/examples/PySDM_examples/seeding/simulation.py index 668fb58e1..c4c8a9567 100644 --- a/examples/PySDM_examples/seeding/simulation.py +++ b/examples/PySDM_examples/seeding/simulation.py @@ -90,7 +90,10 @@ def run(self): data[data == 0] = np.nan attr.append(data) for key, prod in output["products"].items(): - prod.append(float(self.particulator.products[key].get())) + value = self.particulator.products[key].get() + if not isinstance(value, float): + (value,) = value + prod.append(float(value)) for out in ("attributes", "products"): for key, val in output[out].items(): output[out][key] = np.array(val) diff --git a/examples/pyproject.toml b/examples/pyproject.toml index 35c56ed16..cd5417fb8 100644 --- a/examples/pyproject.toml +++ b/examples/pyproject.toml @@ -1,5 +1,5 @@ [tool.setuptools_scm] +root = ".." -# TODO #1200 [build-system] -requires = ['setuptools==56.0.0', 'setuptools-scm==6.0.1'] +requires = ['setuptools==75.3.0', 'setuptools-scm==8.1.0'] diff --git a/examples/setup.py b/examples/setup.py index 19e1ba97d..cd25e23bc 100644 --- a/examples/setup.py +++ b/examples/setup.py @@ -26,7 +26,6 @@ def get_long_description(): use_scm_version={ "local_scheme": lambda _: "", "version_scheme": "post-release", - "root": "..", }, install_requires=[ "PySDM", diff --git a/pyproject.toml b/pyproject.toml index 75861c208..2f8d54ffa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,6 +3,5 @@ profile = "black" [tool.setuptools_scm] -# TODO #1200 [build-system] -requires = ['setuptools==56.0.0', 'setuptools-scm==6.0.1'] +requires = ['setuptools==75.3.0', 'setuptools-scm==8.1.0'] diff --git a/setup.py b/setup.py index 46941d0eb..036f4cfa4 100644 --- a/setup.py +++ b/setup.py @@ -79,8 +79,8 @@ def get_long_description(): "matplotlib", "pytest", "pytest-timeout", - "PyPartMC==1.3.6", ] + + (["PyPartMC==1.3.6"] if sys.version_info < (3, 12) else []) # TODO #1410 + ( [ "pywinpty" + ("==0.5.7" if CI else ""), diff --git a/tests/smoke_tests/box/partmc/test_dry_wet_equilibration.py b/tests/smoke_tests/box/partmc/test_dry_wet_equilibration.py index 8725b9ebc..5420773b2 100644 --- a/tests/smoke_tests/box/partmc/test_dry_wet_equilibration.py +++ b/tests/smoke_tests/box/partmc/test_dry_wet_equilibration.py @@ -3,6 +3,7 @@ # pylint: disable=missing-function-docstring,no-member import platform +import sys from collections import namedtuple import numpy as np @@ -16,7 +17,7 @@ from PySDM.initialisation.spectra import Lognormal from PySDM.physics import si -if platform.architecture()[0] == "64bit": +if platform.architecture()[0] == "64bit" and sys.version_info < (3, 12): # TODO #1410 import PyPartMC linestyles = {"PyPartMC": "dashed", "PySDM": "dotted"} @@ -74,7 +75,8 @@ def pypartmc(dry_diam, temp, rel_humid, kpa): @pytest.mark.skipif( - platform.architecture()[0] != "64bit", reason="binary package availability" + platform.architecture()[0] != "64bit" or sys.version_info >= (3, 12), + reason="binary package availability", # TODO #1410 ) @pytest.mark.parametrize("kappa", (0.1, 1)) @pytest.mark.parametrize("temperature", (300 * si.K,)) diff --git a/tests/smoke_tests/kinematic_2d/arabas_et_al_2015/test_adaptive_displacement.py b/tests/smoke_tests/kinematic_2d/arabas_et_al_2015/test_adaptive_displacement.py index e9bee6bfb..3b2ca7b31 100644 --- a/tests/smoke_tests/kinematic_2d/arabas_et_al_2015/test_adaptive_displacement.py +++ b/tests/smoke_tests/kinematic_2d/arabas_et_al_2015/test_adaptive_displacement.py @@ -70,6 +70,6 @@ def test_adaptive_displacement(rtol, plot=False): # Assert if rtol is not None: assert 1 < simulation.particulator.dynamics["Displacement"]._n_substeps < 50 - assert np.count_nonzero(sd_count) == np.product(settings.grid) + assert np.count_nonzero(sd_count) == np.prod(settings.grid) assert np.std(sd_count) < settings.n_sd_per_gridbox / 2.5 assert np.max(sd_count) < 2.5 * settings.n_sd_per_gridbox diff --git a/tests/smoke_tests/no_env/lamb_et_al_2017/test_fig_4.py b/tests/smoke_tests/no_env/lamb_et_al_2017/test_fig_4.py index 4c1f8d352..e749380cf 100644 --- a/tests/smoke_tests/no_env/lamb_et_al_2017/test_fig_4.py +++ b/tests/smoke_tests/no_env/lamb_et_al_2017/test_fig_4.py @@ -40,7 +40,7 @@ def test_values_match(notebook_local_variables, T, alpha_i_2H, paper): plot_x = notebook_local_variables["T"] plot_y = notebook_local_variables["alphas"][paper] eps = 5e-1 - index = np.where(abs(plot_x - T) < eps) + ((index,),) = np.where(abs(plot_x - T) < eps) np.testing.assert_approx_equal( actual=plot_y[index], desired=alpha_i_2H, significant=3 ) diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py index 445a0471c..158dc7285 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_3.py @@ -36,7 +36,7 @@ class TestFig3: ), ) def test_top_left_panel(notebook_local_variables, isotope, F, enrichment): - index = np.where(notebook_local_variables["F"] == F) + ((index,),) = np.where(notebook_local_variables["F"] == F) np.testing.assert_approx_equal( actual=notebook_local_variables["enrichments"][isotope][index], desired=enrichment, @@ -54,7 +54,7 @@ def test_top_left_panel(notebook_local_variables, isotope, F, enrichment): ), ) def test_bottom_left_panel(notebook_local_variables, label, F, excess): - index = np.where(notebook_local_variables["F"] == F) + ((index,),) = np.where(notebook_local_variables["F"] == F) excesses = notebook_local_variables["excess"] deltas = notebook_local_variables["deltas"] np.testing.assert_approx_equal( @@ -73,7 +73,7 @@ def test_bottom_left_panel(notebook_local_variables, label, F, excess): ) def test_top_right_panel(notebook_local_variables, delta_18O, delta_2H): eps = 0.01 * PER_MILLE - index = np.where( + ((index,),) = np.where( abs(notebook_local_variables["deltas"]["18O"] - delta_18O) < eps ) np.testing.assert_approx_equal( @@ -92,7 +92,7 @@ def test_gmvl(notebook_local_variables, delta_18O, delta_2H): eps = 0.1 * PER_MILLE x = np.linspace(-10 * PER_MILLE, 10 * PER_MILLE, 100) y = x * cd.CRAIG_1961_SLOPE_COEFF + cd.CRAIG_1961_INTERCEPT_COEFF - index = np.where(abs(x - delta_18O) < eps) + ((index,),) = np.where(abs(x - delta_18O) < eps) np.testing.assert_approx_equal(actual=y[index], desired=delta_2H, significant=3) @staticmethod @@ -108,7 +108,7 @@ def test_gmvl(notebook_local_variables, delta_18O, delta_2H): def test_bottom_right_panel(notebook_local_variables, label, delta_18O, excess): eps = 0.1 * PER_MILLE deltas = notebook_local_variables["deltas"] - index = np.where(abs(deltas["18O"] - delta_18O) < eps) + ((index,),) = np.where(abs(deltas["18O"] - delta_18O) < eps) excesses = notebook_local_variables["excess"] np.testing.assert_approx_equal( actual={ diff --git a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py index 644036102..2bf8b6ebe 100644 --- a/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py +++ b/tests/smoke_tests/no_env/pierchala_et_al_2022/test_fig_4.py @@ -38,7 +38,7 @@ class TestFig4: def test_top_panel(notebook_local_variables, RH, delta_18O, delta_2H): deltas_per_rh = notebook_local_variables["deltas_per_rh"] eps = 0.5 * PER_MILLE - index = np.where(abs(deltas_per_rh[RH]["18O"] - delta_18O) < eps) + ((index,),) = np.where(abs(deltas_per_rh[RH]["18O"] - delta_18O) < eps) np.testing.assert_approx_equal( actual=delta_2H, desired=deltas_per_rh[RH]["2H"][index], significant=3 ) @@ -58,7 +58,7 @@ def test_top_panel(notebook_local_variables, RH, delta_18O, delta_2H): def test_bottom_panel(notebook_local_variables, RH, delta_18O, excess_17O): deltas_per_rh = notebook_local_variables["deltas_per_rh"] eps = 0.5 * PER_MILLE - index = np.where(abs(deltas_per_rh[RH]["18O"] - delta_18O) < eps) + ((index,),) = np.where(abs(deltas_per_rh[RH]["18O"] - delta_18O) < eps) np.testing.assert_approx_equal( actual=notebook_local_variables[ "formulae" diff --git a/tests/smoke_tests/parcel_b/arabas_and_shima_2017/test_conservation.py b/tests/smoke_tests/parcel_b/arabas_and_shima_2017/test_conservation.py index b8cd0a0b0..c59d00ed2 100644 --- a/tests/smoke_tests/parcel_b/arabas_and_shima_2017/test_conservation.py +++ b/tests/smoke_tests/parcel_b/arabas_and_shima_2017/test_conservation.py @@ -47,7 +47,7 @@ def test_water_mass_conservation(settings_idx, mass_of_dry_air, scheme, coord): output = simulation.run() # Assert - total_water_mixing_ratio = simulation.particulator.environment[ + (total_water_mixing_ratio,) = simulation.particulator.environment[ "water_vapour_mixing_ratio" ].to_ndarray() + liquid_water_mixing_ratio(simulation) np.testing.assert_approx_equal( @@ -77,4 +77,4 @@ def test_energy_conservation(settings_idx, mass_of_dry_air, coord): simulation.run() # Assert - np.testing.assert_approx_equal(thd0.to_ndarray(), env["thd"].to_ndarray()) + np.testing.assert_array_almost_equal(thd0.to_ndarray(), env["thd"].to_ndarray()) diff --git a/tests/smoke_tests/parcel_b/arabas_and_shima_2017/test_initialisation.py b/tests/smoke_tests/parcel_b/arabas_and_shima_2017/test_initialisation.py index 3137232d8..016372f83 100644 --- a/tests/smoke_tests/parcel_b/arabas_and_shima_2017/test_initialisation.py +++ b/tests/smoke_tests/parcel_b/arabas_and_shima_2017/test_initialisation.py @@ -13,9 +13,8 @@ class TestInitialisation: @staticmethod def simulation_test(var, expected, setup): simulation = Simulation(setup) - np.testing.assert_approx_equal( - simulation.particulator.environment[var].to_ndarray(), expected - ) + (actual,) = simulation.particulator.environment[var].to_ndarray() + np.testing.assert_approx_equal(actual=actual, desired=expected) @staticmethod @pytest.mark.parametrize("settings_idx", range(len(setups))) diff --git a/tests/unit_tests/attributes/test_isotopes.py b/tests/unit_tests/attributes/test_isotopes.py index 1f39945d2..b427818fb 100644 --- a/tests/unit_tests/attributes/test_isotopes.py +++ b/tests/unit_tests/attributes/test_isotopes.py @@ -85,15 +85,16 @@ def test_delta_attribute(backend_class, isotope, heavier_water_specific_content) particulator = builder.build(attributes=attributes) # act - delta = particulator.attributes[f"delta_{isotope}"].to_ndarray() + (delta,) = particulator.attributes[f"delta_{isotope}"].to_ndarray() # assert - n_heavy_isotope = attributes[f"moles_{isotope}"][0] - n_light_water = ( + ((n_heavy_isotope,),) = attributes[f"moles_{isotope}"] + (n_light_water,) = ( (1 - heavier_water_specific_content) * attributes["water mass"] / (constants_defaults.M_1H * 2 + constants_defaults.M_16O) ) + print(delta, n_heavy_isotope, n_light_water) if isotope[-1] == "O": n_light_isotope = n_light_water elif isotope[-1] == "H": diff --git a/tests/unit_tests/backends/test_freezing_methods.py b/tests/unit_tests/backends/test_freezing_methods.py index 9fcaad257..719a738eb 100644 --- a/tests/unit_tests/backends/test_freezing_methods.py +++ b/tests/unit_tests/backends/test_freezing_methods.py @@ -91,8 +91,9 @@ def test_freeze_singular(backend_class): particulator.run(steps=steps) # assert + (qi,) = particulator.products["qi"].get() np.testing.assert_approx_equal( - actual=np.asarray(particulator.products["qi"].get()), + actual=qi, desired=n_sd * multiplicity * water_mass / dv, significant=7, ) diff --git a/tests/unit_tests/dynamics/collisions/test_efficiencies.py b/tests/unit_tests/dynamics/collisions/test_efficiencies.py index bbe9551e8..2ac166ed3 100644 --- a/tests/unit_tests/dynamics/collisions/test_efficiencies.py +++ b/tests/unit_tests/dynamics/collisions/test_efficiencies.py @@ -101,7 +101,7 @@ def test_efficiency_dist(sut, backend_class=CPU, plot=False): ) particulator.attributes.mark_updated("water mass") sut(eff, is_first_in_pair) - res[i, j] = eff.data + (res[i, j],) = eff.data # plot pyplot.colorbar( diff --git a/tests/unit_tests/dynamics/collisions/test_fragmentations.py b/tests/unit_tests/dynamics/collisions/test_fragmentations.py index a89b7ac0c..6bbe51bcc 100644 --- a/tests/unit_tests/dynamics/collisions/test_fragmentations.py +++ b/tests/unit_tests/dynamics/collisions/test_fragmentations.py @@ -413,7 +413,7 @@ def test_fragmentation_nf_and_frag_mass_equals( # TODO #987 sut(nf, frag_mass, u01, is_first_in_pair) # Assert - np.testing.assert_approx_equal(nf.to_ndarray(), expected_nf) + np.testing.assert_array_almost_equal(nf.to_ndarray(), expected_nf) np.testing.assert_array_almost_equal( [expected_frag_mass], frag_mass.to_ndarray() ) diff --git a/tests/unit_tests/dynamics/test_seeding.py b/tests/unit_tests/dynamics/test_seeding.py index b7dad9fa6..dc063d77b 100644 --- a/tests/unit_tests/dynamics/test_seeding.py +++ b/tests/unit_tests/dynamics/test_seeding.py @@ -64,7 +64,10 @@ def simulation(*, dynamics): if step != 0: particulator.run(steps=1) for key, val in products.items(): - val.append(float(particulator.products[key].get())) + value = particulator.products[key].get() + if not isinstance(value, float): + (value,) = value + val.append(float(value)) for key in products: products[key] = np.array(products[key]) return products diff --git a/tests/unit_tests/dynamics/test_terminal_velocity.py b/tests/unit_tests/dynamics/test_terminal_velocity.py index 993adfe1f..0b148bc76 100644 --- a/tests/unit_tests/dynamics/test_terminal_velocity.py +++ b/tests/unit_tests/dynamics/test_terminal_velocity.py @@ -80,7 +80,7 @@ def test_terminal_velocity_boundary_values( # act with context: - v_term = particulator.attributes["terminal velocity"].to_ndarray() + (v_term,) = particulator.attributes["terminal velocity"].to_ndarray() # assert np.testing.assert_approx_equal(v_term, expected_v_term) diff --git a/tests/unit_tests/impl/test_moments.py b/tests/unit_tests/impl/test_moments.py index a51c0d8d4..d688fed45 100644 --- a/tests/unit_tests/impl/test_moments.py +++ b/tests/unit_tests/impl/test_moments.py @@ -56,7 +56,7 @@ def test_moment_0d(backend_class): particulator.moments( moment_0=moment_0, moments=moments, specs={"temperature": (2,)} ) - discr_mean_T_squared = moments[0, slice(0, 1)].to_ndarray() + (discr_mean_T_squared,) = moments[0, slice(0, 1)].to_ndarray() # Assert assert abs(discr_zero - 1) / 1 < 1e-3 diff --git a/tests/unit_tests/physics/test_spectra.py b/tests/unit_tests/physics/test_spectra.py index f291649c5..2321f5540 100644 --- a/tests/unit_tests/physics/test_spectra.py +++ b/tests/unit_tests/physics/test_spectra.py @@ -27,14 +27,15 @@ def test_size_distribution_r_mode(): # Arrange s = 1.001 r_mode = 1e-6 - sut = Lognormal(1, r_mode, s) + sut = Lognormal(norm_factor=1, m_mode=r_mode, s_geom=s) # Act - m, _ = np.linspace(0.01e-6, 100e-6, 10000, retstep=True) + m = np.linspace(start=0.01e-6, stop=100e-6, num=1000) sd = sut.size_distribution(m) # Assert - assert_approx_equal(m[sd == np.amax(sd)], r_mode, 2) + ((index,),) = np.where(sd == np.amax(sd)) + assert_approx_equal(actual=m[index], desired=r_mode, significant=2) class TestExponential: # pylint: disable=too-few-public-methods diff --git a/tests/unit_tests/products/test_concentration_product.py b/tests/unit_tests/products/test_concentration_product.py index 88d666674..868b682b9 100644 --- a/tests/unit_tests/products/test_concentration_product.py +++ b/tests/unit_tests/products/test_concentration_product.py @@ -33,7 +33,7 @@ def test_stp(backend_instance, stp): particulator.environment["rhod"] = RHOD # act - prod = particulator.products["total particle concentration"].get() + (prod,) = particulator.products["total particle concentration"].get() # assert np.testing.assert_approx_equal( @@ -56,7 +56,7 @@ def test_specific(backend_instance, specific): particulator.environment["rhod"] = RHOD # act - prod = particulator.products["particle concentration"].get() + (prod,) = particulator.products["particle concentration"].get() # assert np.testing.assert_approx_equal(