Commit 8e1f48ce authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b14154b6
...@@ -299,13 +299,13 @@ type ZBigFile struct { ...@@ -299,13 +299,13 @@ type ZBigFile struct {
type zBigFileState ZBigFile // hide state methods from public API type zBigFileState ZBigFile // hide state methods from public API
// DropState implements Stateful. // DropState implements zodb.Stateful.
func (bf *zBigFileState) DropState() { func (bf *zBigFileState) DropState() {
bf.blksize = -1 bf.blksize = -1
bf.blktab = nil bf.blktab = nil
} }
// PySetState implements PyStateful. // PySetState implements zodb.PyStateful.
func (bf *zBigFileState) PySetState(pystate interface{}) (err error) { func (bf *zBigFileState) PySetState(pystate interface{}) (err error) {
// ZBigFile // ZBigFile
// .blksize xint // .blksize xint
......
...@@ -39,6 +39,7 @@ import ( ...@@ -39,6 +39,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
// TestZBlk verifies that ZBlk* and ZBigFile saved by Python can be read correctly by Go.
func TestZBlk(t *testing.T) { func TestZBlk(t *testing.T) {
X := exc.Raiseif X := exc.Raiseif
assert := require.New(t) assert := require.New(t)
...@@ -101,7 +102,15 @@ func TestZBlk(t *testing.T) { ...@@ -101,7 +102,15 @@ func TestZBlk(t *testing.T) {
t.Fatalf("zf: blksize=%d; want %d", zf.blksize, blksize) t.Fatalf("zf: blksize=%d; want %d", zf.blksize, blksize)
} }
// XXX zf.blktab.Get(0) -> z0 z0_, ok, err := zf.blktab.Get(ctx, 0); X(err)
// XXX zf.blktab.Get(1) -> z1 if !(ok && z0_ == z0) {
t.Fatalf("zf: [0] -> %#v; want z0", z0_)
}
z1_, ok, err := zf.blktab.Get(ctx,1); X(err)
if !(ok && z1_ == z1) {
t.Fatalf("zf: [1] -> %#v; want z1", z1_)
}
// XXX check zf.blktab.MaxKey ?
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment