]> arthur.barton.de Git - bup.git/blob - lib/bup/t/thelpers.py
18f5e890bf413edfd8d97e9ef9f03fed46cab6a0
[bup.git] / lib / bup / t / thelpers.py
1 import os, math
2 import bup._helpers as _helpers
3
4 from bup.helpers import *
5 from wvtest import *
6
7 @wvtest
8 def test_parse_num():
9     pn = parse_num
10     WVPASSEQ(pn('1'), 1)
11     WVPASSEQ(pn('0'), 0)
12     WVPASSEQ(pn('1.5k'), 1536)
13     WVPASSEQ(pn('2 gb'), 2*1024*1024*1024)
14     WVPASSEQ(pn('1e+9 k'), 1000000000 * 1024)
15     WVPASSEQ(pn('-3e-3mb'), int(-0.003 * 1024 * 1024))
16
17
18 @wvtest
19 def test_detect_fakeroot():
20     if os.getenv('FAKEROOTKEY'):
21         WVPASS(detect_fakeroot())
22     else:
23         WVPASS(not detect_fakeroot())