Skip to content

Commit

Permalink
python version required reduced
Browse files Browse the repository at this point in the history
  • Loading branch information
AviaAv committed Dec 7, 2023
1 parent 84f818c commit de8c872
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions unit-tests/live/frames/test-fps-permutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand All @@ -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"
Expand Down

0 comments on commit de8c872

Please sign in to comment.