Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zope-container
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
Boxiang Sun
zope-container
Commits
749d4970
Commit
749d4970
authored
Feb 20, 2013
by
Stephan Richter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a few more tests.
parent
e64a066d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
8 deletions
+67
-8
MANIFEST.in
MANIFEST.in
+4
-0
src/zope/container/constraints.py
src/zope/container/constraints.py
+6
-7
src/zope/container/contained.py
src/zope/container/contained.py
+5
-1
src/zope/container/tests/test_constraints.py
src/zope/container/tests/test_constraints.py
+2
-0
tox.ini
tox.ini
+50
-0
No files found.
MANIFEST.in
View file @
749d4970
include *.txt
include MANIFEST.in
include buildout.cfg
include compat.cfg
recursive-include src *.py *.txt *.zcml *.c
recursive-include include *.h *.txt
src/zope/container/constraints.py
View file @
749d4970
...
...
@@ -310,18 +310,18 @@ class ItemTypePrecondition(_TypesBased):
>>> try:
... precondition(None, 'foo', ob)
... except InvalidItemType as v:
...
print(v.args[0], (v.args[1] is ob), (v.args[2] == (I1, I2)
))
...
v.args[0], (v.args[1] is ob), (v.args[2] == (I1, I2
))
... else:
... print('Should have failed')
None True True
(None, True, True)
>>> try:
... precondition.factory(None, 'foo', factory)
... except InvalidItemType as v:
...
print(v.args[0], (v.args[1] is factory), (v.args[2] == (I1, I2)
))
...
v.args[0], (v.args[1] is factory), (v.args[2] == (I1, I2
))
... else:
... print('Should have failed')
None True True
(None, True, True)
>>> zope.interface.classImplements(Ob, I2)
>>> precondition(None, 'foo', ob)
...
...
@@ -416,15 +416,14 @@ class ContainerTypesConstraint(_TypesBased):
>>> try:
... constraint(ob)
... except InvalidContainerType as v:
...
print((v.args[0] is ob), (v.args[1] == (I1, I2)
))
...
(v.args[0] is ob), (v.args[1] == (I1, I2
))
... else:
... print('Should have failed')
True True
(True, True)
>>> zope.interface.classImplements(Ob, I2)
>>> constraint(Ob())
True
"""
def
__call__
(
self
,
object
):
for
iface
in
self
.
types
:
...
...
src/zope/container/contained.py
View file @
749d4970
...
...
@@ -13,6 +13,7 @@
##############################################################################
"""Classes to support implementing `IContained`
"""
import
sys
import
zope.component
import
zope.interface.declarations
from
zope.interface
import
providedBy
,
Interface
...
...
@@ -47,6 +48,8 @@ except NameError:
# Py3: Define unicode type.
unicode
=
str
PY3
=
sys
.
version_info
[
0
]
>=
3
@
zope
.
interface
.
implementer
(
IContained
)
class
Contained
(
object
):
"""Stupid mix-in that defines `__parent__` and `__name__` attributes"""
...
...
@@ -521,7 +524,8 @@ def setitem(container, setitemf, name, object):
...
TypeError: name not unicode or ascii string
>>> setitem(container, container.__setitem__, b'hello ' + bytes([200]), item)
>>> c = bytes([200]) if PY3 else chr(200)
>>> setitem(container, container.__setitem__, b'hello ' + c, item)
Traceback (most recent call last):
...
TypeError: name not unicode or ascii string
...
...
src/zope/container/tests/test_constraints.py
View file @
749d4970
...
...
@@ -13,12 +13,14 @@
##############################################################################
"""Container constraint tests
"""
from
__future__
import
print_function
import
doctest
import
unittest
from
zope.testing
import
module
from
zope.container
import
testing
def
setUp
(
test
):
test
.
globs
[
'print_function'
]
=
print_function
module
.
setUp
(
test
,
'zope.container.constraints_txt'
)
def
tearDown
(
test
):
...
...
tox.ini
View file @
749d4970
...
...
@@ -4,3 +4,53 @@ envlist = py26,py27,py33
[testenv]
commands
=
python setup.py test -q
deps
=
zope.testrunner
zope.testing
six
zope.interface
zope.dottedname
zope.schema
zope.component
zope.event
zope.location
zope.security
zope.lifecycleevent
zope.i18nmessageid
zope.filerepresentation
zope.size
zope.traversing
zope.publisher
persistent
BTrees
[testenv:coverage]
basepython
=
python2.7
commands
=
# The installed version messes up nose's test discovery / coverage reporting
# So, we uninstall that from the environment, and then install the editable
# version, before running nosetests.
pip
uninstall
-y
zope.container
pip
install
-e
.
nosetests
--with-xunit
--with-xcoverage
deps
=
nose
coverage
nosexcover
zope.testrunner
zope.testing
six
zope.interface
zope.dottedname
zope.schema
zope.component
zope.event
zope.location
zope.security
zope.lifecycleevent
zope.i18nmessageid
zope.filerepresentation
zope.size
zope.traversing
zope.publisher
persistent
BTrees
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