summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-11-22 20:22:35 +0100
committerhut <hut@lavabit.com>2010-11-22 20:22:35 +0100
commitc518f34e2e6300178a93c801f59413473748adb9 (patch)
treea64423d7c9bac55414931ba1dbb644632b9869b3 /ranger
parentcb41ff7ba0c1a60044bb4329812ceb9920965f03 (diff)
downloadranger-c518f34e2e6300178a93c801f59413473748adb9.tar.gz
ext.human_readable: added doctest
Diffstat (limited to 'ranger')
-rw-r--r--ranger/ext/human_readable.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/ranger/ext/human_readable.py b/ranger/ext/human_readable.py
index 40111b6d..3ce6498a 100644
--- a/ranger/ext/human_readable.py
+++ b/ranger/ext/human_readable.py
@@ -18,11 +18,11 @@ def human_readable(byte, seperator=' '):
 	Convert a large number of bytes to an easily readable format.
 
 	>>> human_readable(54)
-	"54 B"
+	'54 B'
 	>>> human_readable(1500)
-	"1.46 K"
+	'1.46 K'
 	>>> human_readable(2 ** 20 * 1023)
-	"1023 M"
+	'1023 M'
 	"""
 	if byte <= 0:
 		return '0'
@@ -49,3 +49,7 @@ def human_readable(byte, seperator=' '):
 	if byte < 2**60:
 		return '%.4g%sP' % (byte / 2**50.0, seperator)
 	return '>9000'
+
+if __name__ == '__main__':
+	import doctest
+	doctest.testmod()
lass='oid'>71679a31 ^
45a26b11 ^


45a26b11 ^
30b5f112 ^
2f82f50a ^
86c1c388 ^
1a3dc91e ^
30b5f112 ^


fbc30231 ^

















cd2458c0 ^

0ae975c2 ^

b21edfaa ^
1900402f ^
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78