Changeset a87154a in rtems-central


Ignore:
Timestamp:
Apr 17, 2020, 5:15:26 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
fd03a17
Parents:
eb54ec9
Message:

applconfig: Add unit tests

Location:
rtemsqual
Files:
13 added
2 edited

Legend:

Unmodified
Added
Removed
  • rtemsqual/applconfig.py

    reb54ec9 ra87154a  
    105105
    106106
     107def _generate_item_set(lines: List[str], constraint: Dict[str, Any]) -> None:
     108    if "set" in constraint:
     109        value_set = constraint["set"]
     110        lines.append("")
     111        lines.append(f"* It shall be an element of {value_set}.")
     112
     113
    107114def _generate_item_custom(lines: List[str], constraint: Dict[str,
    108115                                                             Any]) -> None:
     
    146153                _start_constraint_list(lines)
    147154                _generate_item_custom(lines, constraint)
    148         else:
    149             raise ValueError
    150155    elif count == 2 and "min" in constraint and "max" in constraint:
    151156        minimum = constraint["min"]
     
    158163        _generate_item_min(lines, constraint)
    159164        _generate_item_max(lines, constraint)
     165        _generate_item_set(lines, constraint)
    160166        _generate_item_custom(lines, constraint)
    161167    content.add_definition_item("VALUE CONSTRAINTS:", lines)
  • rtemsqual/content.py

    reb54ec9 ra87154a  
    209209    def write(self, path):
    210210        """ Writes the content to the file specified by the path. """
    211         os.makedirs(os.path.dirname(path), exist_ok=True)
     211        directory = os.path.dirname(path)
     212        if directory:
     213            os.makedirs(directory, exist_ok=True)
    212214        with open(path, "w+") as out:
    213215            out.write(self._content)
Note: See TracChangeset for help on using the changeset viewer.