File: test_01_eval.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 (23 lines) | stat: -rw-r--r-- 495 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
from __future__ import annotations

import pytest

from pint.pint_eval import plain_tokenizer, uncertainty_tokenizer

VALUES = [
    "1",
    "1 + 2 + 5",
    "10 m",
    "10 metros + 5 segundos",
    "10 metros * (5 segundos)",
]


def _tok(tok, value):
    return tuple(tok(value))


@pytest.mark.parametrize("tokenizer", (plain_tokenizer, uncertainty_tokenizer))
@pytest.mark.parametrize("value", VALUES)
def test_pint_eval(benchmark, tokenizer, value):
    benchmark(_tok, tokenizer, value)