From 3c0ec72defd96b0757d22a19a8e11581f9e4e530 Mon Sep 17 00:00:00 2001 From: Andrea Date: Sun, 2 Apr 2023 23:34:00 +0800 Subject: [PATCH] Fix test for data generation time report --- .../tests/cover/test_statistical_events.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hypothesis-python/tests/cover/test_statistical_events.py b/hypothesis-python/tests/cover/test_statistical_events.py index 56b3733769..8e889aeaeb 100644 --- a/hypothesis-python/tests/cover/test_statistical_events.py +++ b/hypothesis-python/tests/cover/test_statistical_events.py @@ -8,6 +8,7 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. +import re import time import traceback @@ -145,7 +146,7 @@ def test(i): @pytest.mark.parametrize("draw_delay", [False, True]) @pytest.mark.parametrize("test_delay", [False, True]) -def test_draw_time_percentage(draw_delay, test_delay): +def test_draw_timing(draw_delay, test_delay): time.freeze() @st.composite @@ -161,11 +162,10 @@ def test(_): stats = describe_statistics(call_for_statistics(test)) if not draw_delay: - assert "~ 0%" in stats - elif test_delay: - assert "~ 50%" in stats + assert "< 1ms" in stats else: - assert "~ 100%" in stats + match = re.search(r"of which ~ (?P\d+)", stats) + assert 49 <= int(match.group("gentime")) <= 51 def test_has_lambdas_in_output():