From a4b7720cb57bb9dc68d9f263bb526918dff0e4a3 Mon Sep 17 00:00:00 2001 From: Werner Lewis Date: Wed, 31 Aug 2022 16:55:44 +0100 Subject: [PATCH] Use `combinations_with_replacement` for inputs When generating combinations of values, `itertools.combinations` will not allow inputs to be repeated. This is replaced so that cases where input values match are generated, i.e. ("0", "0"). Signed-off-by: Werner Lewis --- tests/scripts/generate_bignum_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scripts/generate_bignum_tests.py b/tests/scripts/generate_bignum_tests.py index 8a8425e1ca..b08ba37852 100755 --- a/tests/scripts/generate_bignum_tests.py +++ b/tests/scripts/generate_bignum_tests.py @@ -166,7 +166,7 @@ class BignumOperation(BignumTarget, metaclass=ABCMeta): """ yield from cast( Iterator[Tuple[str, str]], - itertools.combinations(cls.input_values, 2) + itertools.combinations_with_replacement(cls.input_values, 2) ) yield from cls.input_cases @@ -215,7 +215,7 @@ class BignumAdd(BignumOperation): test_name = "MPI add" input_cases = cast( List[Tuple[str, str]], - list(itertools.combinations( + list(itertools.combinations_with_replacement( [ "1c67967269c6", "9cde3", "-1c67967269c6", "-9cde3",