File: test_ulid_parsing.py

package info (click to toggle)
python-ulid-transform 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 380 kB
  • sloc: cpp: 942; python: 695; sh: 5; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 649 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
import pytest
import tests.conftest  # noqa

example = "01J3MS6XG9XC7X9FR15J9A82ZP"


@pytest.mark.benchmark(group="ulid_parsing")
def test_ut_decode(benchmark, impl):
    assert isinstance(benchmark(lambda: impl.ulid_to_bytes(example)), bytes)


@pytest.mark.benchmark(group="ulid_parsing")
def test_ulid2_decode(benchmark):
    ulid2 = pytest.importorskip("ulid2")
    assert isinstance(benchmark(lambda: ulid2.decode_ulid_base32(example)), bytes)


@pytest.mark.benchmark(group="ulid_parsing")
def test_ulidpy_decode(benchmark):
    ulid = pytest.importorskip("ulid")
    assert isinstance(benchmark(lambda: ulid.from_str(example).bytes), bytes)