From de8c872676b1aa4300314e4d3aa3bf6372e8638b Mon Sep 17 00:00:00 2001 From: Avia Avraham <145359432+AviaAv@users.noreply.github.com> Date: Sun, 12 Nov 2023 10:34:49 +0200 Subject: [PATCH] python version required reduced --- unit-tests/live/frames/test-fps-permutations.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/unit-tests/live/frames/test-fps-permutations.py b/unit-tests/live/frames/test-fps-permutations.py index 08844c20537..a40b44621f6 100644 --- a/unit-tests/live/frames/test-fps-permutations.py +++ b/unit-tests/live/frames/test-fps-permutations.py @@ -87,6 +87,11 @@ def get_dict_for_permutation(sensor_profiles_arr, permutation): return partial_dict +# To reduce required python version, we implement choose instead of using math.comb +def choose(n, k): + return math.factorial(n)/(math.factorial(k) * math.factorial(n - k)) + + def get_time_est_string(num_profiles, modes): s = "Estimated time for test:" details_str = "" @@ -100,8 +105,9 @@ def get_time_est_string(num_profiles, modes): test_time = math.factorial(num_profiles) * time_per_test details_str += f"{math.factorial(num_profiles)} tests for all permutations" elif mode == ALL_PAIRS: - test_time = math.comb(num_profiles, 2) * time_per_test - details_str += f"{math.comb(num_profiles,2)} tests for all pairs" + # test_time = math.comb(num_profiles, 2) * time_per_test + test_time = choose(num_profiles, 2) * time_per_test + details_str += f"{choose(num_profiles,2)} tests for all pairs" elif mode == ALL_SENSORS: test_time = time_per_test details_str += f"1 test for all sensors on"