File: assertion_error_in_string.py

package info (click to toggle)
loguru 0.7.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,568 kB
  • sloc: python: 13,164; javascript: 49; makefile: 14
file content (16 lines) | stat: -rw-r--r-- 269 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import sys

from loguru import logger

logger.remove()
logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True)


def foo(abc, xyz):
    exec("assert abc > 10 and xyz == 60")


try:
    foo(9, 55)
except AssertionError:
    logger.exception("")