gruns / icecream

🍦 Never use print() to debug again.
MIT License
9.2k stars 186 forks source link

Icecream produces strange output when used within doctest #178

Open tschoenfelder opened 8 months ago

tschoenfelder commented 8 months ago

Hello,

I tried to use ic within doctests (python 3.11.8) : import doctest from icecream import ic

def tester(): """

tester() """ a = ic(5*3) print(f"{a=}")

if name == 'main': doctest.testmod()

doctest will return

ic| 5*3: 15


File "C:/Users/U070420/Downloads/ictest.py", line 6, in main.tester Failed example: tester() Expected nothing Got: a=15


1 items had failures: 1 of 1 in main.tester Test Failed 1 failures.

where the print works as expected, but icecream produces strange output.

Any way around this?

Thank you!

Best regards, Torsten