Skip to content

Commit

Permalink
Fix regen title without braces
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Jan 14, 2022
1 parent 0ce3eeb commit a3bc71c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pytest_param_files/__init__.py
@@ -1,4 +1,4 @@
"""Create pytest parametrize decorators from external files."""
from .main import ParamTestData # noqa: F401

__version__ = "0.3.3"
__version__ = "0.3.4"
9 changes: 6 additions & 3 deletions pytest_param_files/main.py
Expand Up @@ -48,7 +48,7 @@ class ParamTestData:
"""The line number in the source file."""
title: str
"""The title of the test."""
description: str
description: Optional[str]
"""The description of the test."""
content: Any
"""The input content of the test."""
Expand Down Expand Up @@ -175,7 +175,7 @@ def read(self) -> Iterator[ParamTestData]:
description = match.group("description")
else:
title = first_line
description = ""
description = None
tests.append([i, title, description])
section = 1
elif section == 1:
Expand Down Expand Up @@ -230,7 +230,10 @@ def regen_file(
actual = "\n".join(line.rstrip() for line in actual.splitlines()).rstrip()
text = []
for index, current in enumerate(self.read()):
text.append(f"[{current.title}] {current.description}\n")
if current.description is not None:
text.append(f"[{current.title}] {current.description}\n")
else:
text.append(f"{current.title}\n")
text.append(".\n")
text.append(current.content)
text.append(".\n")
Expand Down

0 comments on commit a3bc71c

Please sign in to comment.