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
4ec0d20a
Commit
4ec0d20a
authored
Jul 31, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More PEP8 cleanup
parent
3d72a8f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
40 deletions
+71
-40
src/Products/ZCatalog/tests/test_catalog.py
src/Products/ZCatalog/tests/test_catalog.py
+62
-34
src/Products/ZCatalog/tests/test_lazy.py
src/Products/ZCatalog/tests/test_lazy.py
+9
-6
No files found.
src/Products/ZCatalog/tests/test_catalog.py
View file @
4ec0d20a
...
@@ -61,12 +61,15 @@ def createDatabase():
...
@@ -61,12 +61,15 @@ def createDatabase():
app
=
createDatabase
()
app
=
createDatabase
()
def
sort
(
iterable
):
def
sort
(
iterable
):
L
=
list
(
iterable
)
L
=
list
(
iterable
)
L
.
sort
()
L
.
sort
()
return
L
return
L
from
OFS.Folder
import
Folder
as
OFS_Folder
from
OFS.Folder
import
Folder
as
OFS_Folder
class
Folder
(
OFS_Folder
):
class
Folder
(
OFS_Folder
):
def
__init__
(
self
,
id
):
def
__init__
(
self
,
id
):
self
.
_setId
(
id
)
self
.
_setId
(
id
)
...
@@ -82,10 +85,11 @@ class CatalogBase:
...
@@ -82,10 +85,11 @@ class CatalogBase:
self
.
_catalog
=
None
self
.
_catalog
=
None
class
TestAddDelColumn
(
CatalogBase
,
unittest
.
TestCase
):
class
TestAddDelColumn
(
CatalogBase
,
unittest
.
TestCase
):
def
testAdd
(
self
):
def
testAdd
(
self
):
self
.
_catalog
.
addColumn
(
'id'
)
self
.
_catalog
.
addColumn
(
'id'
)
self
.
assertEqual
(
self
.
_catalog
.
schema
.
has_key
(
'id'
),
1
,
self
.
assertEqual
(
'id'
in
self
.
_catalog
.
schema
,
True
,
'add column failed'
)
'add column failed'
)
def
testAddBad
(
self
):
def
testAddBad
(
self
):
...
@@ -94,10 +98,12 @@ class TestAddDelColumn(CatalogBase,unittest.TestCase):
...
@@ -94,10 +98,12 @@ class TestAddDelColumn(CatalogBase,unittest.TestCase):
def
testDel
(
self
):
def
testDel
(
self
):
self
.
_catalog
.
addColumn
(
'id'
)
self
.
_catalog
.
addColumn
(
'id'
)
self
.
_catalog
.
delColumn
(
'id'
)
self
.
_catalog
.
delColumn
(
'id'
)
self
.
assert_
(
self
.
_catalog
.
schema
.
has_key
(
'id'
)
!=
1
,
self
.
assert_
(
'id'
not
in
self
.
_catalog
.
schema
,
'del column failed'
)
'del column failed'
)
class
TestAddDelIndexes
(
CatalogBase
,
unittest
.
TestCase
):
class
TestAddDelIndexes
(
CatalogBase
,
unittest
.
TestCase
):
def
testAddFieldIndex
(
self
):
def
testAddFieldIndex
(
self
):
idx
=
FieldIndex
(
'id'
)
idx
=
FieldIndex
(
'id'
)
self
.
_catalog
.
addIndex
(
'id'
,
idx
)
self
.
_catalog
.
addIndex
(
'id'
,
idx
)
...
@@ -124,7 +130,7 @@ class TestAddDelIndexes(CatalogBase, unittest.TestCase):
...
@@ -124,7 +130,7 @@ class TestAddDelIndexes(CatalogBase, unittest.TestCase):
idx
=
FieldIndex
(
'id'
)
idx
=
FieldIndex
(
'id'
)
self
.
_catalog
.
addIndex
(
'id'
,
idx
)
self
.
_catalog
.
addIndex
(
'id'
,
idx
)
self
.
_catalog
.
delIndex
(
'id'
)
self
.
_catalog
.
delIndex
(
'id'
)
self
.
assert_
(
self
.
_catalog
.
indexes
.
has_key
(
'id'
)
!=
1
,
self
.
assert_
(
'id'
not
in
self
.
_catalog
.
indexes
,
'del index failed'
)
'del index failed'
)
def
testDelTextIndex
(
self
):
def
testDelTextIndex
(
self
):
...
@@ -133,14 +139,14 @@ class TestAddDelIndexes(CatalogBase, unittest.TestCase):
...
@@ -133,14 +139,14 @@ class TestAddDelIndexes(CatalogBase, unittest.TestCase):
index_factory
=
OkapiIndex
,
lexicon_id
=
'lexicon'
)
index_factory
=
OkapiIndex
,
lexicon_id
=
'lexicon'
)
self
.
_catalog
.
addIndex
(
'id'
,
idx
)
self
.
_catalog
.
addIndex
(
'id'
,
idx
)
self
.
_catalog
.
delIndex
(
'id'
)
self
.
_catalog
.
delIndex
(
'id'
)
self
.
assert_
(
self
.
_catalog
.
indexes
.
has_key
(
'id'
)
!=
1
,
self
.
assert_
(
'id'
not
in
self
.
_catalog
.
indexes
,
'del index failed'
)
'del index failed'
)
def
testDelKeywordIndex
(
self
):
def
testDelKeywordIndex
(
self
):
idx
=
KeywordIndex
(
'id'
)
idx
=
KeywordIndex
(
'id'
)
self
.
_catalog
.
addIndex
(
'id'
,
idx
)
self
.
_catalog
.
addIndex
(
'id'
,
idx
)
self
.
_catalog
.
delIndex
(
'id'
)
self
.
_catalog
.
delIndex
(
'id'
)
self
.
assert_
(
self
.
_catalog
.
indexes
.
has_key
(
'id'
)
!=
1
,
self
.
assert_
(
'id'
not
in
self
.
_catalog
.
indexes
,
'del index failed'
)
'del index failed'
)
# Removed unittests dealing with catalog instantiation and vocabularies
# Removed unittests dealing with catalog instantiation and vocabularies
...
@@ -155,13 +161,16 @@ class zdummy(ExtensionClass.Base):
...
@@ -155,13 +161,16 @@ class zdummy(ExtensionClass.Base):
def
title
(
self
):
def
title
(
self
):
return
'%d'
%
self
.
num
return
'%d'
%
self
.
num
class
zdummyFalse
(
zdummy
):
class
zdummyFalse
(
zdummy
):
def
__nonzero__
(
self
):
def
__nonzero__
(
self
):
return
False
return
False
# make objects with failing __len__ and __nonzero__
# make objects with failing __len__ and __nonzero__
class
dummyLenFail
(
zdummy
):
class
dummyLenFail
(
zdummy
):
def
__init__
(
self
,
num
,
fail
):
def
__init__
(
self
,
num
,
fail
):
zdummy
.
__init__
(
self
,
num
)
zdummy
.
__init__
(
self
,
num
)
self
.
fail
=
fail
self
.
fail
=
fail
...
@@ -169,6 +178,7 @@ class dummyLenFail(zdummy):
...
@@ -169,6 +178,7 @@ class dummyLenFail(zdummy):
def
__len__
(
self
):
def
__len__
(
self
):
self
.
fail
(
"__len__() was called"
)
self
.
fail
(
"__len__() was called"
)
class
dummyNonzeroFail
(
zdummy
):
class
dummyNonzeroFail
(
zdummy
):
def
__init__
(
self
,
num
,
fail
):
def
__init__
(
self
,
num
,
fail
):
zdummy
.
__init__
(
self
,
num
)
zdummy
.
__init__
(
self
,
num
)
...
@@ -177,23 +187,28 @@ class dummyNonzeroFail(zdummy):
...
@@ -177,23 +187,28 @@ class dummyNonzeroFail(zdummy):
def
__nonzero__
(
self
):
def
__nonzero__
(
self
):
self
.
fail
(
"__nonzero__() was called"
)
self
.
fail
(
"__nonzero__() was called"
)
class
FakeTraversalError
(
KeyError
):
class
FakeTraversalError
(
KeyError
):
"""fake traversal exception for testing"""
"""fake traversal exception for testing"""
class
fakeparent
(
Implicit
):
class
fakeparent
(
Implicit
):
# fake parent mapping unrestrictedTraverse to
# fake parent mapping unrestrictedTraverse to
# catalog.resolve_path as simulated by TestZCatalog
# catalog.resolve_path as simulated by TestZCatalog
def
__init__
(
self
,
d
):
self
.
d
=
d
marker
=
object
()
marker
=
object
()
def
__init__
(
self
,
d
):
self
.
d
=
d
def
unrestrictedTraverse
(
self
,
path
,
default
=
marker
):
def
unrestrictedTraverse
(
self
,
path
,
default
=
marker
):
result
=
self
.
d
.
get
(
path
,
default
)
result
=
self
.
d
.
get
(
path
,
default
)
if
result
is
self
.
marker
:
if
result
is
self
.
marker
:
raise
FakeTraversalError
(
path
)
raise
FakeTraversalError
(
path
)
return
result
return
result
class
TestZCatalog
(
unittest
.
TestCase
):
class
TestZCatalog
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -233,7 +248,7 @@ class TestZCatalog(unittest.TestCase):
...
@@ -233,7 +248,7 @@ class TestZCatalog(unittest.TestCase):
self
.
assertEqual
(
data
[
'title'
][
0
],
testNum
)
self
.
assertEqual
(
data
[
'title'
][
0
],
testNum
)
def
testSearch
(
self
):
def
testSearch
(
self
):
query
=
{
'title'
:
[
'5'
,
'6'
,
'7'
]}
query
=
{
'title'
:
[
'5'
,
'6'
,
'7'
]}
sr
=
self
.
_catalog
.
searchResults
(
query
)
sr
=
self
.
_catalog
.
searchResults
(
query
)
self
.
assertEqual
(
len
(
sr
),
3
)
self
.
assertEqual
(
len
(
sr
),
3
)
sr
=
self
.
_catalog
.
search
(
query
)
sr
=
self
.
_catalog
.
search
(
query
)
...
@@ -281,7 +296,8 @@ class TestZCatalog(unittest.TestCase):
...
@@ -281,7 +296,8 @@ class TestZCatalog(unittest.TestCase):
def
redirect
(
self
,
url
):
def
redirect
(
self
,
url
):
pass
pass
# this next call should not fail
# this next call should not fail
self
.
_catalog
.
manage_catalogObject
(
None
,
myresponse
(),
'URL1'
,
urls
=
(
'11'
,
'12'
))
self
.
_catalog
.
manage_catalogObject
(
None
,
myresponse
(),
'URL1'
,
urls
=
(
'11'
,
'12'
))
def
testBooleanEvalOn_refreshCatalog_getobject
(
self
):
def
testBooleanEvalOn_refreshCatalog_getobject
(
self
):
# wrap catalog under the fake parent providing unrestrictedTraverse()
# wrap catalog under the fake parent providing unrestrictedTraverse()
...
@@ -297,7 +313,9 @@ class TestZCatalog(unittest.TestCase):
...
@@ -297,7 +313,9 @@ class TestZCatalog(unittest.TestCase):
# neither should these
# neither should these
catalog
.
getobject
(
rid
)
catalog
.
getobject
(
rid
)
def
test_getobject_doesntMaskTraversalErrorsAndDoesntDelegateTo_resolve_url
(
self
):
def
test_getobject_traversal
(
self
):
# getobject doesn't mask TraversalErrors and doesn't delegate to
# resolve_url
# wrap catalog under the fake parent providing unrestrictedTraverse()
# wrap catalog under the fake parent providing unrestrictedTraverse()
catalog
=
self
.
_catalog
.
__of__
(
fakeparent
(
self
.
d
))
catalog
=
self
.
_catalog
.
__of__
(
fakeparent
(
self
.
d
))
# make resolve_url fail if ZCatalog falls back on it
# make resolve_url fail if ZCatalog falls back on it
...
@@ -309,15 +327,20 @@ class TestZCatalog(unittest.TestCase):
...
@@ -309,15 +327,20 @@ class TestZCatalog(unittest.TestCase):
rid0
=
catalog
.
getrid
(
'0'
)
rid0
=
catalog
.
getrid
(
'0'
)
# lets set it up so the traversal fails
# lets set it up so the traversal fails
del
self
.
d
[
'0'
]
del
self
.
d
[
'0'
]
self
.
assertRaises
(
FakeTraversalError
,
catalog
.
getobject
,
rid0
,
REQUEST
=
object
())
self
.
assertRaises
(
FakeTraversalError
,
# and if there is a None at the traversal point, that's where it should return
catalog
.
getobject
,
rid0
,
REQUEST
=
object
())
# and if there is a None at the traversal point, that's where it
# should return
self
.
d
[
'0'
]
=
None
self
.
d
[
'0'
]
=
None
self
.
assertEquals
(
catalog
.
getobject
(
rid0
),
None
)
self
.
assertEquals
(
catalog
.
getobject
(
rid0
),
None
)
class
dummy
(
ExtensionClass
.
Base
):
class
dummy
(
ExtensionClass
.
Base
):
att1
=
'att1'
att1
=
'att1'
att2
=
'att2'
att2
=
'att2'
att3
=
[
'att3'
]
att3
=
[
'att3'
]
def
__init__
(
self
,
num
):
def
__init__
(
self
,
num
):
self
.
num
=
num
self
.
num
=
num
...
@@ -330,6 +353,7 @@ class dummy(ExtensionClass.Base):
...
@@ -330,6 +353,7 @@ class dummy(ExtensionClass.Base):
def
col3
(
self
):
def
col3
(
self
):
return
[
'col3'
]
return
[
'col3'
]
class
TestCatalogObject
(
unittest
.
TestCase
):
class
TestCatalogObject
(
unittest
.
TestCase
):
upper
=
1000
upper
=
1000
...
@@ -363,7 +387,7 @@ class TestCatalogObject(unittest.TestCase):
...
@@ -363,7 +387,7 @@ class TestCatalogObject(unittest.TestCase):
att2
=
ZCTextIndex
(
'att2'
,
caller
=
self
.
_catalog
,
att2
=
ZCTextIndex
(
'att2'
,
caller
=
self
.
_catalog
,
index_factory
=
OkapiIndex
,
lexicon_id
=
'lexicon'
)
index_factory
=
OkapiIndex
,
lexicon_id
=
'lexicon'
)
att3
=
KeywordIndex
(
'att3'
)
att3
=
KeywordIndex
(
'att3'
)
num
=
FieldIndex
(
'num'
)
num
=
FieldIndex
(
'num'
)
self
.
_catalog
.
addIndex
(
'att1'
,
att1
)
self
.
_catalog
.
addIndex
(
'att1'
,
att1
)
self
.
_catalog
.
addIndex
(
'att2'
,
att2
)
self
.
_catalog
.
addIndex
(
'att2'
,
att2
)
...
@@ -395,7 +419,7 @@ class TestCatalogObject(unittest.TestCase):
...
@@ -395,7 +419,7 @@ class TestCatalogObject(unittest.TestCase):
# Queries used to do the same, because of a bug in the
# Queries used to do the same, because of a bug in the
# parseIndexRequest function, mistaking a CatalogSearchArgumentsMap
# parseIndexRequest function, mistaking a CatalogSearchArgumentsMap
# for a Record class
# for a Record class
a
=
self
.
_catalog
({
'col1'
:
''
,
'col2'
:
''
,
'col3'
:
''
})
a
=
self
.
_catalog
({
'col1'
:
''
,
'col2'
:
''
,
'col3'
:
''
})
self
.
assertEqual
(
len
(
a
),
0
,
self
.
assertEqual
(
len
(
a
),
0
,
'length should be %s, its %s'
%
(
upper
,
len
(
a
)))
'length should be %s, its %s'
%
(
upper
,
len
(
a
)))
...
@@ -471,13 +495,13 @@ class TestCatalogObject(unittest.TestCase):
...
@@ -471,13 +495,13 @@ class TestCatalogObject(unittest.TestCase):
self
.
assertRaises
(
CatalogError
,
self
.
badsortindex
)
self
.
assertRaises
(
CatalogError
,
self
.
badsortindex
)
def
badsortindex
(
self
):
def
badsortindex
(
self
):
a
=
self
.
_catalog
(
sort_on
=
'foofaraw'
)
self
.
_catalog
(
sort_on
=
'foofaraw'
)
def
testWrongKindOfIndexForSort
(
self
):
def
testWrongKindOfIndexForSort
(
self
):
self
.
assertRaises
(
CatalogError
,
self
.
wrongsortindex
)
self
.
assertRaises
(
CatalogError
,
self
.
wrongsortindex
)
def
wrongsortindex
(
self
):
def
wrongsortindex
(
self
):
a
=
self
.
_catalog
(
sort_on
=
'att2'
)
self
.
_catalog
(
sort_on
=
'att2'
)
def
testTextIndexQWithSortOn
(
self
):
def
testTextIndexQWithSortOn
(
self
):
upper
=
self
.
upper
upper
=
self
.
upper
...
@@ -566,33 +590,36 @@ class TestCatalogObject(unittest.TestCase):
...
@@ -566,33 +590,36 @@ class TestCatalogObject(unittest.TestCase):
class
objRS
(
ExtensionClass
.
Base
):
class
objRS
(
ExtensionClass
.
Base
):
def
__init__
(
self
,
num
):
def
__init__
(
self
,
num
):
self
.
number
=
num
self
.
number
=
num
class
TestRS
(
unittest
.
TestCase
):
class
TestRS
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_catalog
=
Catalog
()
self
.
_catalog
=
Catalog
()
index
=
FieldIndex
(
'number'
)
index
=
FieldIndex
(
'number'
)
self
.
_catalog
.
addIndex
(
'number'
,
index
)
self
.
_catalog
.
addIndex
(
'number'
,
index
)
self
.
_catalog
.
addColumn
(
'number'
)
self
.
_catalog
.
addColumn
(
'number'
)
for
i
in
range
(
5000
):
for
i
in
range
(
5000
):
obj
=
objRS
(
random
.
randrange
(
0
,
20000
))
obj
=
objRS
(
random
.
randrange
(
0
,
20000
))
self
.
_catalog
.
catalogObject
(
obj
,
i
)
self
.
_catalog
.
catalogObject
(
obj
,
i
)
self
.
_catalog
.
aq_parent
=
objRS
(
200
)
self
.
_catalog
.
aq_parent
=
objRS
(
200
)
def
testRangeSearch
(
self
):
def
testRangeSearch
(
self
):
for
i
in
range
(
1000
):
for
i
in
range
(
1000
):
m
=
random
.
randrange
(
0
,
20000
)
m
=
random
.
randrange
(
0
,
20000
)
n
=
m
+
1000
n
=
m
+
1000
for
r
in
self
.
_catalog
.
searchResults
(
for
r
in
self
.
_catalog
.
searchResults
(
number
=
{
'query'
:
(
m
,
n
)
,
'range'
:
'min:max'
}
):
number
=
{
'query'
:
(
m
,
n
),
'range'
:
'min:max'
}):
size
=
r
.
number
size
=
r
.
number
self
.
assert_
(
m
<=
size
and
size
<=
n
,
self
.
assert_
(
m
<=
size
and
size
<=
n
,
"%d vs [%d,%d]"
%
(
r
.
number
,
m
,
n
))
"%d vs [%d,%d]"
%
(
r
.
number
,
m
,
n
))
class
TestMerge
(
unittest
.
TestCase
):
class
TestMerge
(
unittest
.
TestCase
):
# Test merging results from multiple catalogs
# Test merging results from multiple catalogs
...
@@ -741,7 +768,8 @@ class TestZCatalogGetObject(unittest.TestCase):
...
@@ -741,7 +768,8 @@ class TestZCatalogGetObject(unittest.TestCase):
catalog
.
catalog_object
(
root
.
ob
)
catalog
.
catalog_object
(
root
.
ob
)
brain
=
catalog
.
searchResults
({
'id'
:
'ob'
})[
0
]
brain
=
catalog
.
searchResults
({
'id'
:
'ob'
})[
0
]
del
root
.
ob
del
root
.
ob
self
.
assertRaises
((
NotFound
,
AttributeError
,
KeyError
),
brain
.
getObject
)
self
.
assertRaises
((
NotFound
,
AttributeError
,
KeyError
),
brain
.
getObject
)
def
test_getObject_restricted_raises_Unauthorized
(
self
):
def
test_getObject_restricted_raises_Unauthorized
(
self
):
# Check that if the object's security does not allow traversal,
# Check that if the object's security does not allow traversal,
...
@@ -865,11 +893,11 @@ class TestZCatalogGetObject(unittest.TestCase):
...
@@ -865,11 +893,11 @@ class TestZCatalogGetObject(unittest.TestCase):
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelColumn
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelColumn
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelIndexes
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelIndexes
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestZCatalog
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestZCatalog
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestCatalogObject
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestCatalogObject
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestRS
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestRS
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestMerge
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestMerge
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestZCatalogGetObject
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestZCatalogGetObject
)
)
return
suite
return
suite
src/Products/ZCatalog/tests/test_lazy.py
View file @
4ec0d20a
...
@@ -15,13 +15,16 @@
...
@@ -15,13 +15,16 @@
import
unittest
import
unittest
class
BaseSequenceTest
(
unittest
.
TestCase
):
class
BaseSequenceTest
(
unittest
.
TestCase
):
def
_compare
(
self
,
lseq
,
seq
):
def
_compare
(
self
,
lseq
,
seq
):
self
.
assertEqual
(
len
(
lseq
),
len
(
seq
))
self
.
assertEqual
(
len
(
lseq
),
len
(
seq
))
self
.
assertEqual
(
list
(
lseq
),
seq
)
self
.
assertEqual
(
list
(
lseq
),
seq
)
class
TestLazyCat
(
BaseSequenceTest
):
class
TestLazyCat
(
BaseSequenceTest
):
def
_createLSeq
(
self
,
*
sequences
):
def
_createLSeq
(
self
,
*
sequences
):
from
Products.ZCatalog.Lazy
import
LazyCat
from
Products.ZCatalog.Lazy
import
LazyCat
return
LazyCat
(
sequences
)
return
LazyCat
(
sequences
)
...
@@ -153,9 +156,9 @@ class TestLazyMop(TestLazyCat):
...
@@ -153,9 +156,9 @@ class TestLazyMop(TestLazyCat):
seq2
=
list
(
hexdigits
)
seq2
=
list
(
hexdigits
)
seq3
=
list
(
letters
)
seq3
=
list
(
letters
)
def
filter
(
x
):
def
filter
(
x
):
if
isinstance
(
x
,
int
):
if
isinstance
(
x
,
int
):
raise
ValueError
raise
ValueError
return
x
.
lower
()
return
x
.
lower
()
lmop
=
self
.
_createLMop
(
filter
,
seq1
,
seq2
,
seq3
)
lmop
=
self
.
_createLMop
(
filter
,
seq1
,
seq2
,
seq3
)
self
.
_compare
(
lmop
,
[
str
(
x
).
lower
()
for
x
in
(
seq2
+
seq3
)])
self
.
_compare
(
lmop
,
[
str
(
x
).
lower
()
for
x
in
(
seq2
+
seq3
)])
...
@@ -164,9 +167,9 @@ class TestLazyMop(TestLazyCat):
...
@@ -164,9 +167,9 @@ class TestLazyMop(TestLazyCat):
seq
=
range
(
10
)
+
list
(
letters
)
seq
=
range
(
10
)
+
list
(
letters
)
def
filter
(
x
):
def
filter
(
x
):
if
isinstance
(
x
,
int
):
if
isinstance
(
x
,
int
):
raise
ValueError
raise
ValueError
return
x
.
lower
()
return
x
.
lower
()
# Unaccessed length
# Unaccessed length
lmop
=
self
.
_createLMop
(
filter
,
seq
)
lmop
=
self
.
_createLMop
(
filter
,
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