summary refs log tree commit diff stats
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
parentcb41ff7ba0c1a60044bb4329812ceb9920965f03 (diff)
downloadranger-c518f34e2e6300178a93c801f59413473748adb9.tar.gz
ext.human_readable: added doctest
-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()
ommitter hut <hut@lavabit.com> 2009-12-11 22:30:07 +0100 Reorganization of gui/widget hierarchy and directory structure' href='/akspecs/ranger/commit/test/tc_directory.py?h=v1.5.1&id=d88232a386dbc2153aa12bea7f30c9c53c414010'>d88232a3 ^
fe179145 ^
9506fb8e ^
fe179145 ^
5822dff7 ^
fe179145 ^
9506fb8e ^
fe179145 ^

fae694a0 ^

fe179145 ^
fae694a0 ^
fe179145 ^
5822dff7 ^
9506fb8e ^
fae694a0 ^
9506fb8e ^
fae694a0 ^
fe179145 ^

fae694a0 ^
fe179145 ^
fae694a0 ^


4c05e43d ^

fae694a0 ^

fe179145 ^

fae694a0 ^




9506fb8e ^
fae694a0 ^
fae694a0 ^
1159f9ec ^



fe179145 ^
5822dff7 ^
9506fb8e ^
fae694a0 ^
fe179145 ^
fae694a0 ^
fe179145 ^

fae694a0 ^

fe179145 ^
fae694a0 ^
9506fb8e ^

f6f26231 ^
4c05e43d ^
f6f26231 ^







9506fb8e ^
fae694a0 ^

f6f26231 ^










4c05e43d ^

fae694a0 ^

fe179145 ^
5822dff7 ^

fe179145 ^
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118