Skip to content

Commit

Permalink
BF+TST(ENH): add additional test + split only once
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikoptic committed Oct 29, 2024
1 parent 898948e commit d112394
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/con_duct/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ def format_field(self, value: Any, format_spec: str) -> Any:
return self.NONE
# if it is a composite :format!conversion, we need to split it
if "!" in format_spec and format_spec.index("!") > 1:
format_spec, conversion = format_spec.split("!")
format_spec, conversion = format_spec.split("!", 1)
else:
conversion = None
try:
Expand Down
11 changes: 11 additions & 0 deletions test/test_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,14 @@ def test_execution_summary_formatted_wall_clock_time_nowvalid(
colors=colors,
)
assert f"Rendering: {GREEN}nan{STOP}" == report.execution_summary_formatted

# or if we really provide bad formatting, e.g. the opposite order of conversion and formatting
report = Report(
"_cmd",
[],
mock_log_paths,
"Rendering: {wall_clock_time!X:.3f}",
clobber=False,
colors=colors,
)
assert f"Rendering: {GREEN}nan{STOP}" == report.execution_summary_formatted

0 comments on commit d112394

Please sign in to comment.