f1tness_parser/obsidian/tests/test_obsidian_parser.py
pro100ton a8d18e7cbc Update obsidian parser
Made it to state where it parses notes to pydantic models
2025-01-12 01:25:26 +03:00

72 lines
2.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from obsidian.notes_parser import serialize_exercise
from obsidian.py_models import Approach, Exercise
import pytest
@pytest.mark.parametrize(
"reps, weight, name, expected",
[
(
"12-12-12-10",
"55-59",
"test_exercise",
Exercise(
name="test_exercise",
splitted_weight=False,
approaches=[
Approach(weight=55, reps=12),
Approach(weight=59, reps=12),
Approach(weight=59, reps=12),
Approach(weight=59, reps=10),
],
),
),
(
"11-9-7",
"",
"test_exercise",
Exercise(
name="test_exercise",
splitted_weight=False,
approaches=[
Approach(weight=0, reps=11),
Approach(weight=0, reps=9),
Approach(weight=0, reps=7),
],
),
),
(
"12-12-12-12",
"15х2-25х2-27.5х2-30х2",
"test_exercise",
Exercise(
name="test_exercise",
splitted_weight=True,
approaches=[
Approach(weight=15, reps=12),
Approach(weight=25, reps=12),
Approach(weight=27.5, reps=12),
Approach(weight=30, reps=12),
],
),
),
(
"12-12-12-12",
"15х2-25х2",
"test_exercise",
Exercise(
name="test_exercise",
splitted_weight=True,
approaches=[
Approach(weight=15, reps=12),
Approach(weight=25, reps=12),
Approach(weight=25, reps=12),
Approach(weight=25, reps=12),
],
),
),
],
)
def test_approach_parsing(reps, weight, name, expected):
exercise = serialize_exercise(reps, weight, name)
assert expected == exercise