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
e09e3235
Commit
e09e3235
authored
Jan 11, 2010
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move new tests into existing unittest module.
parent
36acf04d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
55 deletions
+50
-55
lib/python/OFS/tests/testSimpleItem.py
lib/python/OFS/tests/testSimpleItem.py
+50
-4
lib/python/OFS/tests/test_SimpleItem.py
lib/python/OFS/tests/test_SimpleItem.py
+0
-51
No files found.
lib/python/OFS/tests/testSimpleItem.py
View file @
e09e3235
...
...
@@ -3,14 +3,60 @@ import unittest
class
TestItem
(
unittest
.
TestCase
):
def
test_z3interfaces
(
self
):
def
_getTargetClass
(
self
):
from
OFS.SimpleItem
import
Item
return
Item
def
_makeOne
(
self
,
*
args
,
**
kw
):
return
self
.
_getTargetClass
()(
*
args
,
**
kw
)
def
test_conforms_to_IItem
(
self
):
from
OFS.interfaces
import
IItem
from
zope.interface.verify
import
verifyClass
verifyClass
(
IItem
,
self
.
_getTargetClass
())
def
test_conforms_to_IManageable
(
self
):
from
OFS.interfaces
import
IManageable
from
OFS.SimpleItem
import
Item
from
zope.interface.verify
import
verifyClass
verifyClass
(
IItem
,
Item
)
verifyClass
(
IManageable
,
Item
)
verifyClass
(
IManageable
,
self
.
_getTargetClass
())
def
test_raise_StandardErrorMessage_str_errorValue
(
self
):
item
=
self
.
_makeOne
()
def
_raise_during_standard_error_message
(
*
args
,
**
kw
):
raise
ZeroDivisionError
(
'testing'
)
item
.
standard_error_message
=
_raise_during_standard_error_message
try
:
item
.
raise_standardErrorMessage
(
error_type
=
OverflowError
,
error_value
=
'simple'
,
REQUEST
=
{
'dummy'
:
''
},
)
except
:
import
sys
self
.
assertEqual
(
sys
.
exc_info
()[
0
],
'OverflowError'
)
value
=
sys
.
exc_info
()[
1
]
self
.
failUnless
(
value
.
startswith
(
"'simple'"
))
self
.
failUnless
(
'full details: testing'
in
value
)
def
test_raise_StandardErrorMessage_TaintedString_errorValue
(
self
):
from
ZPublisher.TaintedString
import
TaintedString
item
=
self
.
_makeOne
()
def
_raise_during_standard_error_message
(
*
args
,
**
kw
):
raise
ZeroDivisionError
(
'testing'
)
item
.
standard_error_message
=
_raise_during_standard_error_message
try
:
item
.
raise_standardErrorMessage
(
error_type
=
OverflowError
,
error_value
=
TaintedString
(
'<simple>'
),
REQUEST
=
{
'dummy'
:
''
},
)
except
:
import
sys
self
.
assertEqual
(
sys
.
exc_info
()[
0
],
'OverflowError'
)
value
=
sys
.
exc_info
()[
1
]
self
.
failIf
(
'<'
in
value
)
class
TestItem_w__name__
(
unittest
.
TestCase
):
...
...
lib/python/OFS/tests/test_SimpleItem.py
deleted
100644 → 0
View file @
36acf04d
import
unittest
class
ItemTests
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
OFS.SimpleItem
import
Item
return
Item
def
_makeOne
(
self
,
*
args
,
**
kw
):
return
self
.
_getTargetClass
()(
*
args
,
**
kw
)
def
test_raise_StandardErrorMessage_str_errorValue
(
self
):
item
=
self
.
_makeOne
()
def
_raise_during_standard_error_message
(
*
args
,
**
kw
):
raise
ZeroDivisionError
(
'testing'
)
item
.
standard_error_message
=
_raise_during_standard_error_message
try
:
item
.
raise_standardErrorMessage
(
error_type
=
OverflowError
,
error_value
=
'simple'
,
REQUEST
=
{
'dummy'
:
''
},
)
except
:
import
sys
self
.
assertEqual
(
sys
.
exc_info
()[
0
],
'OverflowError'
)
value
=
sys
.
exc_info
()[
1
]
self
.
failUnless
(
value
.
startswith
(
"'simple'"
))
self
.
failUnless
(
'full details: testing'
in
value
)
def
test_raise_StandardErrorMessage_TaintedString_errorValue
(
self
):
from
ZPublisher.TaintedString
import
TaintedString
item
=
self
.
_makeOne
()
def
_raise_during_standard_error_message
(
*
args
,
**
kw
):
raise
ZeroDivisionError
(
'testing'
)
item
.
standard_error_message
=
_raise_during_standard_error_message
try
:
item
.
raise_standardErrorMessage
(
error_type
=
OverflowError
,
error_value
=
TaintedString
(
'<simple>'
),
REQUEST
=
{
'dummy'
:
''
},
)
except
:
import
sys
self
.
assertEqual
(
sys
.
exc_info
()[
0
],
'OverflowError'
)
value
=
sys
.
exc_info
()[
1
]
self
.
failIf
(
'<'
in
value
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
ItemTests
),
))
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