File: test_01_registry_creation.py

package info (click to toggle)
python-pint 0.24.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,924 kB
  • sloc: python: 19,983; makefile: 149
file content (24 lines) | stat: -rw-r--r-- 608 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from __future__ import annotations

import pint


def test_create_empty_registry(benchmark):
    benchmark(pint.UnitRegistry, None)


def test_create_tiny_registry(benchmark, tiny_definition_file):
    benchmark(pint.UnitRegistry, tiny_definition_file)


def test_create_default_registry(benchmark):
    benchmark(
        pint.UnitRegistry,
        cache_folder=None,
    )


def test_create_default_registry_use_cache(benchmark, tmppath_factory):
    folder = tmppath_factory / "cache01"
    pint.UnitRegistry(cache_folder=tmppath_factory / "cache01")
    benchmark(pint.UnitRegistry, cache_folder=folder)