• David Runge's avatar
    Simplify convert and add class for template rendering · 9cff77d7
    David Runge authored
    repo_management/convert.py:
    Add the class `RepoDbFile` which is used to initialize a jinja
    environment and allows to render the 'desc.j2' and 'files.j2' templates.
    Add `_desc_data_line_to_dicts()` which allows for assigning the data
    from a line in a 'desc' file to be assigned to a dict, that corresponds
    to the line's designated data type.
    Simplify `_desc_data_to_model()` by making use of
    `_desc_data_line_to_dicts()`.
    Change `_desc_data_to_model()` by guarding against pydantic
    ValidationErrors and raising a RepoManagementValidationError instead.
    
    tests/test_convert.py:
    Add tests for `RepoDbFile`.
    9cff77d7
test_convert.py 6.8 KB