From 88cc24242aa9d1c10b5cdfe875d378cadce1a4ed Mon Sep 17 00:00:00 2001 From: leo-desbureaux-tellae Date: Thu, 7 Mar 2024 16:23:49 +0100 Subject: [PATCH] add test for get_value_for_feature --- tests/sources/test_global_distribution.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/sources/test_global_distribution.py b/tests/sources/test_global_distribution.py index 3a0df55..10d2a67 100644 --- a/tests/sources/test_global_distribution.py +++ b/tests/sources/test_global_distribution.py @@ -1,6 +1,7 @@ from bhepop2.sources.global_distribution import QuantitativeGlobalDistribution import pytest +from numpy.random import default_rng class TestQuantitativeGlobalDistribution: @@ -33,3 +34,13 @@ def test_validate_data(self, filosofi_global_distribution_nantes): QuantitativeGlobalDistribution( filosofi_global_distribution_nantes.drop([filosofi_global_distribution_nantes.index[0]], axis=0) ) + + def test_get_value_for_feature(self, filosofi_global_distribution_nantes, test_seed, mocker): + rng = default_rng(test_seed) + global_distribution = QuantitativeGlobalDistribution( + filosofi_global_distribution_nantes + ) + + assert round(global_distribution.get_value_for_feature(5, rng), 2) == 23526.75 + +