epics-containers / pvi

EPICS PV Interface described in YAML
https://epics-containers.github.io/pvi
Apache License 2.0
4 stars 2 forks source link

Add better validation for ButtonPanel actions #110

Closed GDYendell closed 5 months ago

GDYendell commented 5 months ago

This causes an error much earlier that more clearly links to the user's code:

...
  File "/workspaces/pvi/tests/test_api.py", line 99, in test_button_raises
    ButtonPanel(actions={"start": "1", "Stop": "0"})
  File "/venv/lib/python3.10/site-packages/pydantic/main.py", line 171, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for ButtonPanel
actions.start.[key]
  String should match pattern '^([A-Z][a-z0-9]*)*$' [type=string_pattern_mismatch, input_value='start', input_type=str]
    For further information visit https://errors.pydantic.dev/2.6/v/string_pattern_mismatc

Fixes #97

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.66%. Comparing base (25343a6) to head (0360cb1).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #110 +/- ## ======================================= Coverage 89.65% 89.66% ======================================= Files 23 23 Lines 1402 1403 +1 ======================================= + Hits 1257 1258 +1 Misses 145 145 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.