From a673f203db4f32c1bad58eee5b560c32f9d657b9 Mon Sep 17 00:00:00 2001 From: Hernan Grecco Date: Thu, 13 Jul 2023 21:28:16 -0300 Subject: [PATCH] Split benchmark for registry creation --- .../benchmarks/test_01_registry_creation.py | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/pint/testsuite/benchmarks/test_01_registry_creation.py b/pint/testsuite/benchmarks/test_01_registry_creation.py index 8b459f2bd..98fb73c41 100644 --- a/pint/testsuite/benchmarks/test_01_registry_creation.py +++ b/pint/testsuite/benchmarks/test_01_registry_creation.py @@ -1,16 +1,21 @@ -import pytest - import pint -@pytest.mark.parametrize("args", [[(None,), tuple(), ("tiny",), ("", None)]]) -def test_create_registry(benchmark, tiny_definition_file, args): - if args[0] == "tiny": - args = (tiny_definition_file, args[1:]) +def test_create_empty_registry(benchmark): + benchmark( + pint.UnitRegistry, + ) + + +def test_create_tiny_registry(benchmark, tiny_definition_file): + benchmark(pint.UnitRegistry, tiny_definition_file) + + +def test_create_default_registry(benchmark): + benchmark( + pint.UnitRegistry, + ) + - @benchmark - def _(): - if len(args) == 2: - pint.UnitRegistry(args[0], cache_folder=args[1]) - else: - pint.UnitRegistry(*args) +def test_create_default_registry_no_cache(benchmark): + benchmark(pint.UnitRegistry, cache_folder=None)