File: test_05_registry_creation.py

package info (click to toggle)
python-pint 0.25.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,940 kB
  • sloc: python: 20,478; makefile: 148
file content (24 lines) | stat: -rw-r--r-- 608 bytes parent folder | download | duplicates (2)
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)