File: memray_style.py

package info (click to toggle)
python-picologging 0.9.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 752 kB
  • sloc: python: 3,921; cpp: 2,430; makefile: 41; sh: 18
file content (29 lines) | stat: -rw-r--r-- 519 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import picologging


def test():
    perc = picologging.PercentStyle("%(msg)s %(levelno)d %(name)s")
    record = picologging.LogRecord(
        "test", picologging.INFO, __file__, 1, "hello", (), None, None, None
    )

    assert perc.format(record) == "hello 20 test"

    try:
        perc.format(None)
    except:
        pass
    try:
        perc.format("")
    except:
        pass

    try:
        perc.format({})
    except:
        pass


if __name__ == "__main__":
    for _ in range(1000):
        test()