diff --git a/tests/utils/test_parser.py b/tests/utils/test_parser.py index 6998cca..50179c7 100644 --- a/tests/utils/test_parser.py +++ b/tests/utils/test_parser.py @@ -17,8 +17,8 @@ def parser() -> Generator[Parser, None, None]: yield parser -def test_parse_variables(parser: Parser): - assert parser.variables == { +def test_parse_sub_pairs(parser: Parser): + assert parser.sub_pairs == { 'varst': 'variable to reStructuredText', 'version': '0.2.0', 'release': 'v0.2.0', diff --git a/varst/application.py b/varst/application.py index 84226ff..8e3c312 100644 --- a/varst/application.py +++ b/varst/application.py @@ -24,6 +24,6 @@ def run(self, argv: Optional[Sequence[str]]) -> None: rst_file = RstFile(src=self.parser.input_file) substitution = Substitution(rst_file) - for k, v in self.parser.variables.items(): + for k, v in self.parser.sub_pairs.items(): substitution.update(k, v) rst_file.save(dest=self.parser.output_file) diff --git a/varst/utils/parser.py b/varst/utils/parser.py index 1ecffb1..f10d96d 100644 --- a/varst/utils/parser.py +++ b/varst/utils/parser.py @@ -17,7 +17,7 @@ class Parser: input_file: str = "" output_file: str = "" - variables: Dict[str, str] = {} + sub_pairs: Dict[str, str] = {} def __init__(self) -> None: self._parser.add_argument( @@ -53,7 +53,7 @@ def parse(self, argv: Optional[Sequence[str]]) -> None: self.input_file = self.output_file = arg_dict['input'] if arg_dict['output'] is not None: self.output_file = arg_dict['output'] - self.variables = _parse_kv(arg_dict['name=value']) + self.sub_pairs = _parse_kv(arg_dict['name=value']) _VARIABLE_PATTERN = re.compile(r"[^=]+=[^=]+")