trace_commentor/tests/test_utils.py
2024-04-19 18:51:21 +08:00

12 lines
459 B
Python

from io import StringIO
from contextlib import closing
from trace_commentor import flags, Commentor
def asserteq_or_print(value, ground_truth):
if flags.DEBUG or flags.PRINT:
print(value)
else:
value = value.strip("\n").rstrip(" ")
ground_truth = ground_truth.strip("\n").rstrip(" ")
assert value == ground_truth, "\n".join(["\n\n<<<<<<<< VALUE", value, "========================", ground_truth, ">>>>>>>> GROUND\n"])