File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 1
1
try :
2
2
import btree
3
3
import uio
4
+ import uerrno
4
5
except ImportError :
5
6
print ("SKIP" )
6
7
import sys
15
16
db [b"foo2" ] = b"bar2"
16
17
db [b"bar1" ] = b"foo1"
17
18
19
+ dbstr = str (db )
20
+ print (dbstr [:7 ], dbstr [- 1 :])
21
+
18
22
print (db [b"foo2" ])
19
23
try :
20
24
print (db [b"foo" ])
56
60
for k , v in db .items (None , None , btree .DESC ):
57
61
print ((k , v ))
58
62
63
+ print (db .seq (1 , b"foo1" ))
64
+ print (db .seq (1 , b"qux" ))
65
+
66
+ try :
67
+ db .seq (b"foo1" )
68
+ except OSError as e :
69
+ print (e .args [0 ] == uerrno .EINVAL )
70
+
59
71
print (list (db .keys ()))
60
72
print (list (db .values ()))
61
73
62
74
for k in db :
63
75
print (k )
64
76
77
+ db .put (b"baz1" , b"qux1" )
78
+
65
79
print ("foo1" , "foo1" in db )
66
80
print ("foo2" , "foo2" in db )
81
+ print ("baz1" , "baz1" in db )
82
+
83
+ try :
84
+ print (db + db [b"foo1" ])
85
+ except TypeError :
86
+ print ("TypeError" )
67
87
68
88
db .close ()
69
89
f .close ()
Original file line number Diff line number Diff line change
1
+ <btree >
1
2
b'bar2'
2
3
KeyError
3
4
None
@@ -25,10 +26,15 @@ KeyError
25
26
(b'foo3', b'bar3')
26
27
(b'foo1', b'bar1')
27
28
(b'bar1', b'foo1')
29
+ (b'foo1', b'bar1')
30
+ None
31
+ True
28
32
[b'bar1', b'foo1', b'foo3']
29
33
[b'foo1', b'bar1', b'bar3']
30
34
b'bar1'
31
35
b'foo1'
32
36
b'foo3'
33
37
foo1 True
34
38
foo2 False
39
+ baz1 True
40
+ TypeError
You can’t perform that action at this time.
0 commit comments