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
c5c034f0
Commit
c5c034f0
authored
Apr 10, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for macro call version/mode checks.
parent
a52a0cab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
0 deletions
+110
-0
lib/python/TAL/test/run.py
lib/python/TAL/test/run.py
+2
-0
lib/python/TAL/test/test_talinterpreter.py
lib/python/TAL/test/test_talinterpreter.py
+53
-0
lib/python/TAL/tests/run.py
lib/python/TAL/tests/run.py
+2
-0
lib/python/TAL/tests/test_talinterpreter.py
lib/python/TAL/tests/test_talinterpreter.py
+53
-0
No files found.
lib/python/TAL/test/run.py
View file @
c5c034f0
...
@@ -7,12 +7,14 @@ import unittest
...
@@ -7,12 +7,14 @@ import unittest
import
test_htmlparser
import
test_htmlparser
import
test_htmltalparser
import
test_htmltalparser
import
test_xmlparser
import
test_xmlparser
import
test_talinterpreter
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
test_htmlparser
.
test_suite
())
suite
.
addTest
(
test_htmlparser
.
test_suite
())
suite
.
addTest
(
test_htmltalparser
.
test_suite
())
suite
.
addTest
(
test_htmltalparser
.
test_suite
())
suite
.
addTest
(
test_xmlparser
.
test_suite
())
suite
.
addTest
(
test_xmlparser
.
test_suite
())
suite
.
addTest
(
test_talinterpreter
.
test_suite
())
return
suite
return
suite
def
main
():
def
main
():
...
...
lib/python/TAL/test/test_talinterpreter.py
0 → 100644
View file @
c5c034f0
#! /usr/bin/env python1.5
"""Tests for TALInterpreter."""
import
sys
import
utils
import
unittest
from
TAL.TALDefs
import
METALError
from
TAL.HTMLTALParser
import
HTMLTALParser
from
TAL.TALInterpreter
import
TALInterpreter
from
TAL.DummyEngine
import
DummyEngine
class
MacroErrorsTestCase
(
unittest
.
TestCase
):
def
_compile
(
self
,
source
):
parser
=
HTMLTALParser
()
parser
.
parseString
(
source
)
program
,
macros
=
parser
.
getCode
()
return
program
,
macros
def
setUp
(
self
):
dummy
,
macros
=
self
.
_compile
(
'<p metal:define-macro="M">Booh</p>'
)
self
.
macro
=
macros
[
'M'
]
self
.
engine
=
DummyEngine
(
macros
)
program
,
dummy
=
self
.
_compile
(
'<p metal:use-macro="M">Bah</p>'
)
self
.
interpreter
=
TALInterpreter
(
program
,
{},
self
.
engine
)
def
tearDown
(
self
):
try
:
self
.
interpreter
()
except
METALError
:
pass
else
:
self
.
fail
(
"Expected METALError"
)
def
check_mode_error
(
self
):
self
.
macro
[
1
]
=
(
"mode"
,
"duh"
)
def
check_version_error
(
self
):
self
.
macro
[
0
]
=
(
"version"
,
"duh"
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
MacroErrorsTestCase
,
"check_"
))
return
suite
if
__name__
==
"__main__"
:
errs
=
utils
.
run_suite
(
test_suite
())
sys
.
exit
(
errs
and
1
or
0
)
lib/python/TAL/tests/run.py
View file @
c5c034f0
...
@@ -7,12 +7,14 @@ import unittest
...
@@ -7,12 +7,14 @@ import unittest
import
test_htmlparser
import
test_htmlparser
import
test_htmltalparser
import
test_htmltalparser
import
test_xmlparser
import
test_xmlparser
import
test_talinterpreter
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
test_htmlparser
.
test_suite
())
suite
.
addTest
(
test_htmlparser
.
test_suite
())
suite
.
addTest
(
test_htmltalparser
.
test_suite
())
suite
.
addTest
(
test_htmltalparser
.
test_suite
())
suite
.
addTest
(
test_xmlparser
.
test_suite
())
suite
.
addTest
(
test_xmlparser
.
test_suite
())
suite
.
addTest
(
test_talinterpreter
.
test_suite
())
return
suite
return
suite
def
main
():
def
main
():
...
...
lib/python/TAL/tests/test_talinterpreter.py
0 → 100644
View file @
c5c034f0
#! /usr/bin/env python1.5
"""Tests for TALInterpreter."""
import
sys
import
utils
import
unittest
from
TAL.TALDefs
import
METALError
from
TAL.HTMLTALParser
import
HTMLTALParser
from
TAL.TALInterpreter
import
TALInterpreter
from
TAL.DummyEngine
import
DummyEngine
class
MacroErrorsTestCase
(
unittest
.
TestCase
):
def
_compile
(
self
,
source
):
parser
=
HTMLTALParser
()
parser
.
parseString
(
source
)
program
,
macros
=
parser
.
getCode
()
return
program
,
macros
def
setUp
(
self
):
dummy
,
macros
=
self
.
_compile
(
'<p metal:define-macro="M">Booh</p>'
)
self
.
macro
=
macros
[
'M'
]
self
.
engine
=
DummyEngine
(
macros
)
program
,
dummy
=
self
.
_compile
(
'<p metal:use-macro="M">Bah</p>'
)
self
.
interpreter
=
TALInterpreter
(
program
,
{},
self
.
engine
)
def
tearDown
(
self
):
try
:
self
.
interpreter
()
except
METALError
:
pass
else
:
self
.
fail
(
"Expected METALError"
)
def
check_mode_error
(
self
):
self
.
macro
[
1
]
=
(
"mode"
,
"duh"
)
def
check_version_error
(
self
):
self
.
macro
[
0
]
=
(
"version"
,
"duh"
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
MacroErrorsTestCase
,
"check_"
))
return
suite
if
__name__
==
"__main__"
:
errs
=
utils
.
run_suite
(
test_suite
())
sys
.
exit
(
errs
and
1
or
0
)
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