File: test_simple_load.py

package info (click to toggle)
python-annotatedyaml 1.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,088 kB
  • sloc: python: 1,303; makefile: 18
file content (27 lines) | stat: -rw-r--r-- 713 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
25
26
27
"""Benchmarks."""

import pathlib

from pytest_codspeed import BenchmarkFixture

from annotatedyaml import parse_yaml

FIXTURE_PATH = pathlib.Path(__file__).parent.parent.joinpath("fixtures")


def test_simple_parse_yaml(benchmark: BenchmarkFixture) -> None:
    """Test parsing a simple YAML file."""
    yaml_str = FIXTURE_PATH.joinpath("simple_automations.yaml").read_text()

    @benchmark
    def _parse_yaml() -> None:
        parse_yaml(yaml_str)


def test_large_parse_yaml(benchmark: BenchmarkFixture) -> None:
    """Test parsing a large YAML file."""
    yaml_str = FIXTURE_PATH.joinpath("large_automations.yaml").read_text()

    @benchmark
    def _parse_yaml() -> None:
        parse_yaml(yaml_str)