Skip to content

Commit 239d938

Browse files
fix tests
1 parent 35598cf commit 239d938

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

codeflash/either.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ def __init__(self, code: str, message_template: str, **formatting_args: str) ->
1717
@property
1818
def message(self) -> str:
1919
try:
20-
formatted = self.message_template.format(**self.formatting_args)
20+
formatted = ""
21+
if not isinstance(self.message_template, str):
22+
formatted = str(self.message_template)
23+
else:
24+
formatted = self.message_template.format(**self.formatting_args)
2125
return f"[{self.code}] {formatted}" # noqa: TRY300
2226
except KeyError:
2327
logger.debug(f"Invalid template: missing {self.formatting_args}")

tests/test_comparator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import pydantic
1414
import pytest
1515

16-
from codeflash.either import Failure, Success
16+
from codeflash.either import CodeflashError, Failure, Success
1717
from codeflash.models.models import FunctionTestInvocation, InvocationId, TestResults, TestType
1818
from codeflash.verification.comparator import comparator
1919
from codeflash.verification.equivalence import compare_test_results
@@ -789,7 +789,7 @@ def test_returns():
789789
a = Success(5)
790790
b = Success(5)
791791
c = Success(6)
792-
d = Failure(5)
792+
d = Failure(CodeflashError("TEST", 5))
793793
e = Success((5, 5))
794794
f = Success((5, 6))
795795
assert comparator(a, b)

0 commit comments

Comments
 (0)