Commit 0a58eb7a authored by Kirill Smelkov's avatar Kirill Smelkov

go/zodb: Fix _TestPersistentMapListLoad on py3_pickle3

plist is generated to come with str in [0]. On py2 that is bytestring,
while on py3 it is unicode. However were trying to decode it as
bytestring only and so it was failing as

    --- FAIL: TestPersistentMapListLoad/py3_pickle3 (0.73s)
        persistent_x_test.go:82: plist[0]: got string  ; expect str

-> Fix it by using ogórek.AsString helper as suggested by
StrictUnicode=y mode documentation in https://github.com/kisielk/og-rek/commit/b28613c2.
parent 1e87fe5b
...@@ -41,10 +41,6 @@ func TestPersistentMapListLoad(t *testing.T) { ...@@ -41,10 +41,6 @@ func TestPersistentMapListLoad(t *testing.T) {
ztestdataReg.RunWithEach(t, _TestPersistentMapListLoad) ztestdataReg.RunWithEach(t, _TestPersistentMapListLoad)
} }
func _TestPersistentMapListLoad(t0 *testing.T, z *ZTestData) { func _TestPersistentMapListLoad(t0 *testing.T, z *ZTestData) {
if z.Kind == "py3_pickle3" {
t0.Skip("xfail")
}
assert := assert.New(t0) assert := assert.New(t0)
tdb := zodb.OpenTestDB(t0, z.Path("data.fs")) tdb := zodb.OpenTestDB(t0, z.Path("data.fs"))
...@@ -81,11 +77,7 @@ func _TestPersistentMapListLoad(t0 *testing.T, z *ZTestData) { ...@@ -81,11 +77,7 @@ func _TestPersistentMapListLoad(t0 *testing.T, z *ZTestData) {
assert.Equal(len(plist.Data), 3) assert.Equal(len(plist.Data), 3)
xa := plist.Data[0] xa := plist.Data[0]
__, ok := xa.(pickle.ByteString) a, err := pickle.AsString(xa); X(err)
if !ok {
t.Fatalf("plist[0]: got %T ; expect str", xa)
}
a := string(__)
assert.Equal(a, "a") assert.Equal(a, "a")
assert.Equal(plist.Data[1], int64(1)) assert.Equal(plist.Data[1], int64(1))
......
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