File: test_util.py

package info (click to toggle)
pycallgraph 1.1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 416 kB
  • sloc: python: 1,925; makefile: 47
file content (14 lines) | stat: -rw-r--r-- 521 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from pycallgraph2 import Util


def test_human_readable_biyte():
    hrb = Util.human_readable_bibyte
    assert hrb(0) == '0.0B'
    assert hrb(1024) == '1.0KiB'
    assert hrb(1024 * 5.2) == '5.2KiB'
    assert hrb(1024 * 1024 * 5.2) == '5.2MiB'
    assert hrb(1024 * 1024 * 1024 * 5.2) == '5.2GiB'
    assert hrb(1024 * 1024 * 1024 * 1024 * 5.2) == '5.2TiB'
    assert hrb(1024 * 1024 * 1024 * 1024 * 1024 * 5.2) == '5324.8TiB'
    assert hrb(-1024 * 1024 * 1024 * 5.2) == '-5.2GiB'
    assert hrb(-1024) == '-1.0KiB'