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
e01fe241
Commit
e01fe241
authored
May 22, 2006
by
Philipp von Weitershausen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use saner test fixtures from Zope 3 tests (which are undoubtedly
the offspring of these insane Zope 2 test fixtures).
parent
a44644aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
40 deletions
+5
-40
lib/python/Products/PageTemplates/tests/__init__.py
lib/python/Products/PageTemplates/tests/__init__.py
+1
-36
lib/python/Products/PageTemplates/tests/testTALES.py
lib/python/Products/PageTemplates/tests/testTALES.py
+4
-4
No files found.
lib/python/Products/PageTemplates/tests/__init__.py
View file @
e01fe241
def
all
():
import
testTALES
return
testTALES
.
test_suite
()
class
harness1
:
def
__init__
(
self
):
self
.
__callstack
=
[]
def
_assert_
(
self
,
name
,
*
args
,
**
kwargs
):
self
.
__callstack
.
append
((
name
,
args
,
kwargs
))
def
_complete_
(
self
):
assert
len
(
self
.
__callstack
)
==
0
,
"Harness methods called"
def
__getattr__
(
self
,
name
):
cs
=
self
.
__callstack
assert
len
(
cs
),
'Unexpected harness method call "%s".'
%
name
assert
cs
[
0
][
0
]
==
name
,
(
'Harness method name "%s" called, "%s" expected.'
%
(
name
,
cs
[
0
][
0
])
)
return
self
.
_method_
def
_method_
(
self
,
*
args
,
**
kwargs
):
name
,
aargs
,
akwargs
=
self
.
__callstack
.
pop
(
0
)
assert
aargs
==
args
,
"Harness method arguments"
assert
akwargs
==
kwargs
,
"Harness method keyword args"
class
harness2
(
harness1
):
def
_assert_
(
self
,
name
,
result
,
*
args
,
**
kwargs
):
self
.
__callstack
.
append
((
name
,
result
,
args
,
kwargs
))
def
_method_
(
self
,
*
args
,
**
kwargs
):
name
,
result
,
aargs
,
akwargs
=
self
.
__callstack
.
pop
(
0
)
assert
aargs
==
args
,
"Harness method arguments"
assert
akwargs
==
kwargs
,
"Harness method keyword args"
return
result
# make this directory a package
lib/python/Products/PageTemplates/tests/testTALES.py
View file @
e01fe241
import
os
,
sys
,
unittest
from
Products.PageTemplates
import
TALES
from
Products.PageTemplates.tests
import
harness1
from
zope.tales.tests.test_tales
import
Harness
import
string
class
DummyUnicodeExpr
:
...
...
@@ -18,14 +18,14 @@ class TALESTests(unittest.TestCase):
def
testIterator0
(
self
):
'''Test sample Iterator class'''
context
=
harness1
(
)
context
=
Harness
(
self
)
it
=
TALES
.
Iterator
(
'name'
,
(),
context
)
assert
not
it
.
next
(),
"Empty iterator"
context
.
_complete_
()
def
testIterator1
(
self
):
'''Test sample Iterator class'''
context
=
harness1
(
)
context
=
Harness
(
self
)
it
=
TALES
.
Iterator
(
'name'
,
(
1
,),
context
)
context
.
_assert_
(
'setLocal'
,
'name'
,
1
)
assert
it
.
next
()
and
not
it
.
next
(),
"Single-element iterator"
...
...
@@ -33,7 +33,7 @@ class TALESTests(unittest.TestCase):
def
testIterator2
(
self
):
'''Test sample Iterator class'''
context
=
harness1
(
)
context
=
Harness
(
self
)
it
=
TALES
.
Iterator
(
'text'
,
'text'
,
context
)
for
c
in
'text'
:
context
.
_assert_
(
'setLocal'
,
'text'
,
c
)
...
...
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