diff --git a/src/con_duct/__main__.py b/src/con_duct/__main__.py index 3e4c5e2..402aa76 100755 --- a/src/con_duct/__main__.py +++ b/src/con_duct/__main__.py @@ -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: diff --git a/test/test_formatter.py b/test/test_formatter.py index 97fb35d..642aad5 100644 --- a/test/test_formatter.py +++ b/test/test_formatter.py @@ -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