diff options
author | Alex March <alex.march.dev@gmail.com> | 2016-09-29 16:12:31 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-10-05 00:17:22 +1100 |
commit | addd1d3db1e8835f9e2d73fd4fbd5ee818bbcb4a (patch) | |
tree | 3ed61bd55092201064765d8aecc8dacaa4b1db03 /tests | |
parent | 99d62c4def5f62af66cf66b3e620de21f017db29 (diff) | |
download | micropython-addd1d3db1e8835f9e2d73fd4fbd5ee818bbcb4a.tar.gz micropython-addd1d3db1e8835f9e2d73fd4fbd5ee818bbcb4a.zip |
tests/extmod/btree1: Checks for put, seq, string print and unsupported binary op.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/extmod/btree1.py | 20 | ||||
-rw-r--r-- | tests/extmod/btree1.py.exp | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/extmod/btree1.py b/tests/extmod/btree1.py index c96cce92d6..6629837661 100644 --- a/tests/extmod/btree1.py +++ b/tests/extmod/btree1.py @@ -1,6 +1,7 @@ try: import btree import uio + import uerrno except ImportError: print("SKIP") import sys @@ -15,6 +16,9 @@ db[b"foo1"] = b"bar1" db[b"foo2"] = b"bar2" db[b"bar1"] = b"foo1" +dbstr = str(db) +print(dbstr[:7], dbstr[-1:]) + print(db[b"foo2"]) try: print(db[b"foo"]) @@ -56,14 +60,30 @@ print("---") for k, v in db.items(None, None, btree.DESC): print((k, v)) +print(db.seq(1, b"foo1")) +print(db.seq(1, b"qux")) + +try: + db.seq(b"foo1") +except OSError as e: + print(e.args[0] == uerrno.EINVAL) + print(list(db.keys())) print(list(db.values())) for k in db: print(k) +db.put(b"baz1", b"qux1") + print("foo1", "foo1" in db) print("foo2", "foo2" in db) +print("baz1", "baz1" in db) + +try: + print(db + db[b"foo1"]) +except TypeError: + print("TypeError") db.close() f.close() diff --git a/tests/extmod/btree1.py.exp b/tests/extmod/btree1.py.exp index 2983a09874..a467252300 100644 --- a/tests/extmod/btree1.py.exp +++ b/tests/extmod/btree1.py.exp @@ -1,3 +1,4 @@ +<btree > b'bar2' KeyError None @@ -25,6 +26,9 @@ KeyError (b'foo3', b'bar3') (b'foo1', b'bar1') (b'bar1', b'foo1') +(b'foo1', b'bar1') +None +True [b'bar1', b'foo1', b'foo3'] [b'foo1', b'bar1', b'bar3'] b'bar1' @@ -32,3 +36,5 @@ b'foo1' b'foo3' foo1 True foo2 False +baz1 True +TypeError |