Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Zope
Commits
d77221f8
Commit
d77221f8
authored
Jul 31, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Lazy test cleanup, test coverage for the __repr__ and __add__ methods
parent
142355c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
14 deletions
+26
-14
src/Products/ZCatalog/tests/test_lazy.py
src/Products/ZCatalog/tests/test_lazy.py
+26
-14
No files found.
src/Products/ZCatalog/tests/test_lazy.py
View file @
d77221f8
...
...
@@ -29,16 +29,28 @@ class TestLazyCat(BaseSequenceTest):
from
Products.ZCatalog.Lazy
import
LazyCat
return
LazyCat
(
sequences
)
def
test
E
mpty
(
self
):
def
test
_e
mpty
(
self
):
lcat
=
self
.
_createLSeq
([])
self
.
_compare
(
lcat
,
[])
def
testSingleSequence
(
self
):
def
test_repr
(
self
):
lcat
=
self
.
_createLSeq
([
0
,
1
])
self
.
assertEquals
(
repr
(
lcat
),
repr
([
0
,
1
]))
def
test_init_single
(
self
):
seq
=
range
(
10
)
lcat
=
self
.
_createLSeq
(
seq
)
self
.
_compare
(
lcat
,
seq
)
def
testMultipleSequences
(
self
):
def
test_add
(
self
):
seq1
=
range
(
10
)
seq2
=
range
(
10
,
20
)
lcat1
=
self
.
_createLSeq
(
seq1
)
lcat2
=
self
.
_createLSeq
(
seq2
)
lcat
=
lcat1
+
lcat2
self
.
_compare
(
lcat
,
range
(
20
))
def
test_init_multiple
(
self
):
from
string
import
hexdigits
,
letters
seq1
=
range
(
10
)
seq2
=
list
(
hexdigits
)
...
...
@@ -46,7 +58,7 @@ class TestLazyCat(BaseSequenceTest):
lcat
=
self
.
_createLSeq
(
seq1
,
seq2
,
seq3
)
self
.
_compare
(
lcat
,
seq1
+
seq2
+
seq3
)
def
test
NestedLazySequences
(
self
):
def
test
_init_nested
(
self
):
from
string
import
hexdigits
,
letters
seq1
=
range
(
10
)
seq2
=
list
(
hexdigits
)
...
...
@@ -55,7 +67,7 @@ class TestLazyCat(BaseSequenceTest):
[
self
.
_createLSeq
(
seq
)
for
seq
in
(
seq1
,
seq2
,
seq3
)])
self
.
_compare
(
lcat
,
seq1
+
seq2
+
seq3
)
def
test
SlicedSequences
(
self
):
def
test
_slicing
(
self
):
from
string
import
hexdigits
,
letters
seq1
=
range
(
10
)
seq2
=
list
(
hexdigits
)
...
...
@@ -64,7 +76,7 @@ class TestLazyCat(BaseSequenceTest):
[
self
.
_createLSeq
(
seq
)
for
seq
in
(
seq1
,
seq2
,
seq3
)])
self
.
_compare
(
lcat
[
5
:
-
5
],
seq1
[
5
:]
+
seq2
+
seq3
[:
-
5
])
def
test
ConsistentL
ength
(
self
):
def
test
_l
ength
(
self
):
# Unaccessed length
lcat
=
self
.
_createLSeq
(
range
(
10
))
self
.
assertEqual
(
len
(
lcat
),
10
)
...
...
@@ -92,7 +104,7 @@ class TestLazyMap(TestLazyCat):
totalseq
.
extend
(
s
)
return
LazyMap
(
mapfunc
,
totalseq
)
def
test
M
ap
(
self
):
def
test
_m
ap
(
self
):
from
string
import
hexdigits
,
letters
seq1
=
range
(
10
)
seq2
=
list
(
hexdigits
)
...
...
@@ -114,7 +126,7 @@ class TestLazyFilter(TestLazyCat):
totalseq
.
extend
(
s
)
return
LazyFilter
(
filter
,
totalseq
)
def
test
F
ilter
(
self
):
def
test
_f
ilter
(
self
):
from
string
import
hexdigits
,
letters
seq1
=
range
(
10
)
seq2
=
list
(
hexdigits
)
...
...
@@ -123,7 +135,7 @@ class TestLazyFilter(TestLazyCat):
lmap
=
self
.
_createLFilter
(
filter
,
seq1
,
seq2
,
seq3
)
self
.
_compare
(
lmap
,
seq2
[
10
:]
+
seq3
)
def
test
ConsistentLengthWithF
ilter
(
self
):
def
test
_length_with_f
ilter
(
self
):
from
string
import
letters
# Unaccessed length
...
...
@@ -153,7 +165,7 @@ class TestLazyMop(TestLazyCat):
totalseq
.
extend
(
s
)
return
LazyMop
(
mapfunc
,
totalseq
)
def
test
M
op
(
self
):
def
test
_m
op
(
self
):
from
string
import
hexdigits
,
letters
seq1
=
range
(
10
)
seq2
=
list
(
hexdigits
)
...
...
@@ -165,7 +177,7 @@ class TestLazyMop(TestLazyCat):
lmop
=
self
.
_createLMop
(
filter
,
seq1
,
seq2
,
seq3
)
self
.
_compare
(
lmop
,
[
str
(
x
).
lower
()
for
x
in
(
seq2
+
seq3
)])
def
test
ConsistentLengthWithMop
(
self
):
def
test
_length_with_filter
(
self
):
from
string
import
letters
seq
=
range
(
10
)
+
list
(
letters
)
...
...
@@ -195,17 +207,17 @@ class TestLazyValues(BaseSequenceTest):
from
Products.ZCatalog.Lazy
import
LazyValues
return
LazyValues
(
seq
)
def
test
E
mpty
(
self
):
def
test
_e
mpty
(
self
):
lvals
=
self
.
_createLValues
([])
self
.
_compare
(
lvals
,
[])
def
test
V
alues
(
self
):
def
test
_v
alues
(
self
):
from
string
import
letters
seq
=
zip
(
letters
,
range
(
10
))
lvals
=
self
.
_createLValues
(
seq
)
self
.
_compare
(
lvals
,
range
(
10
))
def
test
Slice
(
self
):
def
test
_slicing
(
self
):
from
string
import
letters
seq
=
zip
(
letters
,
range
(
10
))
lvals
=
self
.
_createLValues
(
seq
)
...
...
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