Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zope.proxy
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.proxy
Commits
4dc6f0c1
Commit
4dc6f0c1
authored
Jun 07, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for DSD providing both instances' interfaces and its own.
parent
3ec047d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
14 deletions
+53
-14
src/zope/proxy/tests/test_decorator.py
src/zope/proxy/tests/test_decorator.py
+53
-14
No files found.
src/zope/proxy/tests/test_decorator.py
View file @
4dc6f0c1
...
...
@@ -27,39 +27,78 @@ class DecoratorSpecificationDescriptorTests(unittest.TestCase):
def
test___get___w_class
(
self
):
from
zope.interface
import
Interface
from
zope.interface
import
implementer
from
zope.interface
import
provider
class
I
Foo
(
Interface
):
class
I
ContextFactory
(
Interface
):
pass
@
provider
(
IFoo
)
class
Foo
(
object
):
class
IContext
(
Interface
):
pass
@
provider
(
IContextFactory
)
@
implementer
(
IContext
)
class
Context
(
object
):
pass
dsd
=
self
.
_makeOne
()
self
.
assertEqual
(
list
(
dsd
.
__get__
(
None
,
Foo
)),
[
IFoo
])
self
.
assertEqual
(
list
(
dsd
.
__get__
(
None
,
Context
)),
[
IContextFactory
])
def
test___get___w_inst_no_proxy
(
self
):
from
zope.interface
import
Interface
from
zope.interface
import
implementer
class
IFoo
(
Interface
):
from
zope.interface
import
provider
class
IContextFactory
(
Interface
):
pass
@
implementer
(
IFoo
)
class
Foo
(
object
):
class
IContext
(
Interface
):
pass
@
provider
(
IContextFactory
)
@
implementer
(
IContext
)
class
Context
(
object
):
pass
dsd
=
self
.
_makeOne
()
self
.
assertEqual
(
list
(
dsd
.
__get__
(
Foo
(),
None
)),
[
IFoo
])
self
.
assertEqual
(
list
(
dsd
.
__get__
(
Context
(),
None
)),
[
IContext
])
def
test___get___w_inst_w_proxy
(
self
):
from
zope.interface
import
Interface
from
zope.interface
import
implementer
from
zope.interface
import
provider
from
zope.proxy
import
ProxyBase
class
I
Foo
(
Interface
):
class
I
ContextFactory
(
Interface
):
pass
@
implementer
(
IFoo
)
class
Foo
(
object
):
class
IContext
(
Interface
):
pass
foo
=
Foo
()
p_foo
=
ProxyBase
(
foo
)
@
provider
(
IContextFactory
)
@
implementer
(
IContext
)
class
Context
(
object
):
pass
context
=
Context
()
proxy
=
ProxyBase
(
context
)
dsd
=
self
.
_makeOne
()
self
.
assertEqual
(
list
(
dsd
.
__get__
(
proxy
,
None
)),
[
IContext
])
def
test___get___w_inst_w_derived_proxy
(
self
):
from
zope.interface
import
Interface
from
zope.interface
import
implementer
from
zope.interface
import
provider
from
zope.proxy
import
ProxyBase
class
IContextFactory
(
Interface
):
pass
class
IContext
(
Interface
):
pass
@
provider
(
IContextFactory
)
@
implementer
(
IContext
)
class
Context
(
object
):
pass
class
IProxyFactory
(
Interface
):
pass
class
IProxy
(
Interface
):
pass
@
provider
(
IProxyFactory
)
@
implementer
(
IProxy
)
class
Proxy
(
ProxyBase
):
pass
context
=
Context
()
proxy
=
Proxy
(
context
)
dsd
=
self
.
_makeOne
()
self
.
assertEqual
(
list
(
dsd
.
__get__
(
p_foo
,
None
)),
[
IFoo
])
self
.
assertEqual
(
list
(
dsd
.
__get__
(
proxy
,
None
)),
[
IContext
,
IProxy
])
def
test___set___not_allowed
(
self
):
from
zope.interface
import
Interface
...
...
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