Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
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
Kirill Smelkov
persistent
Commits
d492ea2e
Commit
d492ea2e
authored
Jun 29, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3k: iterators, grrrr.
parent
e3f5a6a5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
persistent/tests/test_picklecache.py
persistent/tests/test_picklecache.py
+18
-15
No files found.
persistent/tests/test_picklecache.py
View file @
d492ea2e
...
@@ -52,8 +52,8 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -52,8 +52,8 @@ class PickleCacheTests(unittest.TestCase):
cache
=
self
.
_makeOne
()
cache
=
self
.
_makeOne
()
self
.
assertEqual
(
len
(
cache
),
0
)
self
.
assertEqual
(
len
(
cache
),
0
)
self
.
assertEqual
(
len
(
cache
.
items
()),
0
)
self
.
assertEqual
(
_
len
(
cache
.
items
()),
0
)
self
.
assertEqual
(
len
(
cache
.
klass_items
()),
0
)
self
.
assertEqual
(
_
len
(
cache
.
klass_items
()),
0
)
self
.
assertEqual
(
cache
.
ringlen
(),
0
)
self
.
assertEqual
(
cache
.
ringlen
(),
0
)
self
.
assertEqual
(
len
(
cache
.
lru_items
()),
0
)
self
.
assertEqual
(
len
(
cache
.
lru_items
()),
0
)
self
.
assertEqual
(
cache
.
cache_size
,
10
)
self
.
assertEqual
(
cache
.
cache_size
,
10
)
...
@@ -109,8 +109,8 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -109,8 +109,8 @@ class PickleCacheTests(unittest.TestCase):
cache
[
'ghost'
]
=
ghost
cache
[
'ghost'
]
=
ghost
self
.
assertEqual
(
len
(
cache
),
1
)
self
.
assertEqual
(
len
(
cache
),
1
)
self
.
assertEqual
(
len
(
cache
.
items
()),
1
)
self
.
assertEqual
(
_
len
(
cache
.
items
()),
1
)
self
.
assertEqual
(
len
(
cache
.
klass_items
()),
0
)
self
.
assertEqual
(
_
len
(
cache
.
klass_items
()),
0
)
self
.
assertEqual
(
cache
.
items
()[
0
][
0
],
'ghost'
)
self
.
assertEqual
(
cache
.
items
()[
0
][
0
],
'ghost'
)
self
.
assertEqual
(
cache
.
ringlen
(),
0
)
self
.
assertEqual
(
cache
.
ringlen
(),
0
)
self
.
failUnless
(
cache
.
items
()[
0
][
1
]
is
ghost
)
self
.
failUnless
(
cache
.
items
()[
0
][
1
]
is
ghost
)
...
@@ -124,8 +124,8 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -124,8 +124,8 @@ class PickleCacheTests(unittest.TestCase):
cache
[
'uptodate'
]
=
uptodate
cache
[
'uptodate'
]
=
uptodate
self
.
assertEqual
(
len
(
cache
),
1
)
self
.
assertEqual
(
len
(
cache
),
1
)
self
.
assertEqual
(
len
(
cache
.
items
()),
1
)
self
.
assertEqual
(
_
len
(
cache
.
items
()),
1
)
self
.
assertEqual
(
len
(
cache
.
klass_items
()),
0
)
self
.
assertEqual
(
_
len
(
cache
.
klass_items
()),
0
)
self
.
assertEqual
(
cache
.
items
()[
0
][
0
],
'uptodate'
)
self
.
assertEqual
(
cache
.
items
()[
0
][
0
],
'uptodate'
)
self
.
assertEqual
(
cache
.
ringlen
(),
1
)
self
.
assertEqual
(
cache
.
ringlen
(),
1
)
self
.
failUnless
(
cache
.
items
()[
0
][
1
]
is
uptodate
)
self
.
failUnless
(
cache
.
items
()[
0
][
1
]
is
uptodate
)
...
@@ -140,8 +140,8 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -140,8 +140,8 @@ class PickleCacheTests(unittest.TestCase):
cache
[
'pclass'
]
=
pclass
cache
[
'pclass'
]
=
pclass
self
.
assertEqual
(
len
(
cache
),
1
)
self
.
assertEqual
(
len
(
cache
),
1
)
self
.
assertEqual
(
len
(
cache
.
items
()),
0
)
self
.
assertEqual
(
_
len
(
cache
.
items
()),
0
)
self
.
assertEqual
(
len
(
cache
.
klass_items
()),
1
)
self
.
assertEqual
(
_
len
(
cache
.
klass_items
()),
1
)
self
.
assertEqual
(
cache
.
klass_items
()[
0
][
0
],
'pclass'
)
self
.
assertEqual
(
cache
.
klass_items
()[
0
][
0
],
'pclass'
)
self
.
failUnless
(
cache
.
klass_items
()[
0
][
1
]
is
pclass
)
self
.
failUnless
(
cache
.
klass_items
()[
0
][
1
]
is
pclass
)
self
.
failUnless
(
cache
[
'pclass'
]
is
pclass
)
self
.
failUnless
(
cache
[
'pclass'
]
is
pclass
)
...
@@ -221,7 +221,7 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -221,7 +221,7 @@ class PickleCacheTests(unittest.TestCase):
cache
[
'three'
]
=
self
.
_makePersist
(
oid
=
'three'
,
state
=
UPTODATE
)
cache
[
'three'
]
=
self
.
_makePersist
(
oid
=
'three'
,
state
=
UPTODATE
)
items
=
cache
.
lru_items
()
items
=
cache
.
lru_items
()
self
.
assertEqual
(
len
(
items
),
3
)
self
.
assertEqual
(
_
len
(
items
),
3
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
1
][
0
],
'two'
)
self
.
assertEqual
(
items
[
1
][
0
],
'two'
)
self
.
assertEqual
(
items
[
2
][
0
],
'three'
)
self
.
assertEqual
(
items
[
2
][
0
],
'three'
)
...
@@ -247,7 +247,7 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -247,7 +247,7 @@ class PickleCacheTests(unittest.TestCase):
self
.
assertEqual
(
cache
.
ringlen
(),
3
)
self
.
assertEqual
(
cache
.
ringlen
(),
3
)
items
=
cache
.
lru_items
()
items
=
cache
.
lru_items
()
self
.
assertEqual
(
len
(
items
),
3
)
self
.
assertEqual
(
_
len
(
items
),
3
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
1
][
0
],
'three'
)
self
.
assertEqual
(
items
[
1
][
0
],
'three'
)
self
.
assertEqual
(
items
[
2
][
0
],
'two'
)
self
.
assertEqual
(
items
[
2
][
0
],
'two'
)
...
@@ -264,7 +264,7 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -264,7 +264,7 @@ class PickleCacheTests(unittest.TestCase):
self
.
assertEqual
(
cache
.
ringlen
(),
2
)
self
.
assertEqual
(
cache
.
ringlen
(),
2
)
items
=
cache
.
lru_items
()
items
=
cache
.
lru_items
()
self
.
assertEqual
(
len
(
items
),
2
)
self
.
assertEqual
(
_
len
(
items
),
2
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
1
][
0
],
'three'
)
self
.
assertEqual
(
items
[
1
][
0
],
'three'
)
...
@@ -281,7 +281,7 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -281,7 +281,7 @@ class PickleCacheTests(unittest.TestCase):
self
.
assertEqual
(
cache
.
ringlen
(),
3
)
self
.
assertEqual
(
cache
.
ringlen
(),
3
)
items
=
cache
.
lru_items
()
items
=
cache
.
lru_items
()
self
.
assertEqual
(
len
(
items
),
3
)
self
.
assertEqual
(
_
len
(
items
),
3
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
1
][
0
],
'three'
)
self
.
assertEqual
(
items
[
1
][
0
],
'three'
)
self
.
assertEqual
(
items
[
2
][
0
],
'two'
)
self
.
assertEqual
(
items
[
2
][
0
],
'two'
)
...
@@ -297,7 +297,7 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -297,7 +297,7 @@ class PickleCacheTests(unittest.TestCase):
self
.
assertEqual
(
cache
.
ringlen
(),
3
)
self
.
assertEqual
(
cache
.
ringlen
(),
3
)
items
=
cache
.
lru_items
()
items
=
cache
.
lru_items
()
self
.
assertEqual
(
len
(
items
),
3
)
self
.
assertEqual
(
_
len
(
items
),
3
)
self
.
assertEqual
(
items
[
0
][
0
],
'two'
)
self
.
assertEqual
(
items
[
0
][
0
],
'two'
)
self
.
assertEqual
(
items
[
1
][
0
],
'three'
)
self
.
assertEqual
(
items
[
1
][
0
],
'three'
)
self
.
assertEqual
(
items
[
2
][
0
],
'one'
)
self
.
assertEqual
(
items
[
2
][
0
],
'one'
)
...
@@ -313,7 +313,7 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -313,7 +313,7 @@ class PickleCacheTests(unittest.TestCase):
self
.
assertEqual
(
cache
.
ringlen
(),
3
)
self
.
assertEqual
(
cache
.
ringlen
(),
3
)
items
=
cache
.
lru_items
()
items
=
cache
.
lru_items
()
self
.
assertEqual
(
len
(
items
),
3
)
self
.
assertEqual
(
_
len
(
items
),
3
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
0
][
0
],
'one'
)
self
.
assertEqual
(
items
[
1
][
0
],
'two'
)
self
.
assertEqual
(
items
[
1
][
0
],
'two'
)
self
.
assertEqual
(
items
[
2
][
0
],
'three'
)
self
.
assertEqual
(
items
[
2
][
0
],
'three'
)
...
@@ -334,7 +334,7 @@ class PickleCacheTests(unittest.TestCase):
...
@@ -334,7 +334,7 @@ class PickleCacheTests(unittest.TestCase):
self
.
assertEqual
(
cache
.
cache_non_ghost_count
,
10
)
self
.
assertEqual
(
cache
.
cache_non_ghost_count
,
10
)
items
=
cache
.
lru_items
()
items
=
cache
.
lru_items
()
self
.
assertEqual
(
len
(
items
),
10
)
self
.
assertEqual
(
_
len
(
items
),
10
)
self
.
assertEqual
(
items
[
0
][
0
],
'oid_0090'
)
self
.
assertEqual
(
items
[
0
][
0
],
'oid_0090'
)
self
.
assertEqual
(
items
[
1
][
0
],
'oid_0091'
)
self
.
assertEqual
(
items
[
1
][
0
],
'oid_0091'
)
self
.
assertEqual
(
items
[
2
][
0
],
'oid_0092'
)
self
.
assertEqual
(
items
[
2
][
0
],
'oid_0092'
)
...
@@ -655,6 +655,9 @@ class DummyConnection:
...
@@ -655,6 +655,9 @@ class DummyConnection:
pass
pass
def
_len
(
seq
):
return
len
(
list
(
seq
))
def
test_suite
():
def
test_suite
():
return
unittest
.
TestSuite
((
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
PickleCacheTests
),
unittest
.
makeSuite
(
PickleCacheTests
),
...
...
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