Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
5f274be4
Commit
5f274be4
authored
Oct 22, 2002
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkUndoInVersion(): Change all the `assert's to self.assertEqual()
via a convenient local variable.
parent
c9852e88
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
src/ZODB/tests/TransactionalUndoVersionStorage.py
src/ZODB/tests/TransactionalUndoVersionStorage.py
+24
-22
No files found.
src/ZODB/tests/TransactionalUndoVersionStorage.py
View file @
5f274be4
...
...
@@ -30,6 +30,8 @@ class TransactionalUndoVersionStorage:
return
self
.
_dostore
(
*
args
,
**
kwargs
)
def
checkUndoInVersion
(
self
):
eq
=
self
.
assertEqual
unless
=
self
.
failUnless
oid
=
self
.
_storage
.
new_oid
()
version
=
'one'
revid_a
=
self
.
_dostore
(
oid
,
data
=
MinPO
(
91
))
...
...
@@ -44,31 +46,31 @@ class TransactionalUndoVersionStorage:
oids
=
self
.
_storage
.
transactionalUndo
(
tid
,
t
)
self
.
_storage
.
tpc_vote
(
t
)
self
.
_storage
.
tpc_finish
(
t
)
assert
len
(
oids
)
==
1
assert
oids
[
0
]
==
oid
eq
(
len
(
oids
),
1
)
eq
(
oids
[
0
],
oid
)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
''
)
assert
revid
==
revid_a
assert
zodb_unpickle
(
data
)
==
MinPO
(
91
)
eq
(
revid
,
revid_a
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
91
)
)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
version
)
assert
revid
>
revid_b
and
revid
>
revid_c
assert
zodb_unpickle
(
data
)
==
MinPO
(
92
)
unless
(
revid
>
revid_b
and
revid
>
revid_c
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
92
)
)
# Now commit the version...
t
=
Transaction
()
self
.
_storage
.
tpc_begin
(
t
)
oids
=
self
.
_storage
.
commitVersion
(
version
,
''
,
t
)
self
.
_storage
.
tpc_vote
(
t
)
self
.
_storage
.
tpc_finish
(
t
)
assert
len
(
oids
)
==
1
assert
oids
[
0
]
==
oid
eq
(
len
(
oids
),
1
)
eq
(
oids
[
0
],
oid
)
#JF# No, because we fall back to non-version data.
#JF# self.assertRaises(POSException.VersionError,
#JF# self._storage.load,
#JF# oid, version)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
version
)
assert
zodb_unpickle
(
data
)
==
MinPO
(
92
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
92
)
)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
''
)
assert
zodb_unpickle
(
data
)
==
MinPO
(
92
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
92
)
)
# ...and undo the commit
info
=
self
.
_storage
.
undoInfo
()
tid
=
info
[
0
][
'id'
]
...
...
@@ -77,20 +79,20 @@ class TransactionalUndoVersionStorage:
oids
=
self
.
_storage
.
transactionalUndo
(
tid
,
t
)
self
.
_storage
.
tpc_vote
(
t
)
self
.
_storage
.
tpc_finish
(
t
)
assert
len
(
oids
)
==
1
assert
oids
[
0
]
==
oid
eq
(
len
(
oids
),
1
)
eq
(
oids
[
0
],
oid
)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
version
)
assert
zodb_unpickle
(
data
)
==
MinPO
(
92
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
92
)
)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
''
)
assert
zodb_unpickle
(
data
)
==
MinPO
(
91
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
91
)
)
# Now abort the version
t
=
Transaction
()
self
.
_storage
.
tpc_begin
(
t
)
oids
=
self
.
_storage
.
abortVersion
(
version
,
t
)
self
.
_storage
.
tpc_vote
(
t
)
self
.
_storage
.
tpc_finish
(
t
)
assert
len
(
oids
)
==
1
assert
oids
[
0
]
==
oid
eq
(
len
(
oids
),
1
)
eq
(
oids
[
0
],
oid
)
# The object should not exist in the version now, but it should exist
# in the non-version
#JF# No, because we fall back
...
...
@@ -98,9 +100,9 @@ class TransactionalUndoVersionStorage:
#JF# self._storage.load,
#JF# oid, version)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
version
)
assert
zodb_unpickle
(
data
)
==
MinPO
(
91
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
91
)
)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
''
)
assert
zodb_unpickle
(
data
)
==
MinPO
(
91
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
91
)
)
# Now undo the abort
info
=
self
.
_storage
.
undoInfo
()
tid
=
info
[
0
][
'id'
]
...
...
@@ -109,13 +111,13 @@ class TransactionalUndoVersionStorage:
oids
=
self
.
_storage
.
transactionalUndo
(
tid
,
t
)
self
.
_storage
.
tpc_vote
(
t
)
self
.
_storage
.
tpc_finish
(
t
)
assert
len
(
oids
)
==
1
assert
oids
[
0
]
==
oid
eq
(
len
(
oids
),
1
)
eq
(
oids
[
0
],
oid
)
# And the object should be back in versions 'one' and ''
data
,
revid
=
self
.
_storage
.
load
(
oid
,
version
)
assert
zodb_unpickle
(
data
)
==
MinPO
(
92
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
92
)
)
data
,
revid
=
self
.
_storage
.
load
(
oid
,
''
)
assert
zodb_unpickle
(
data
)
==
MinPO
(
91
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
91
)
)
def
checkUndoCommitVersion
(
self
):
def
load_value
(
oid
,
version
=
''
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment