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
fadaad25
Commit
fadaad25
authored
Nov 21, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid 'p' as a variable name for debugging ease.
parent
4dc6f0c1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
49 deletions
+50
-49
src/zope/proxy/tests/test_proxy.py
src/zope/proxy/tests/test_proxy.py
+50
-49
No files found.
src/zope/proxy/tests/test_proxy.py
View file @
fadaad25
...
@@ -63,8 +63,8 @@ class PyProxyBaseTestCase(unittest.TestCase):
...
@@ -63,8 +63,8 @@ class PyProxyBaseTestCase(unittest.TestCase):
def
__new__
(
cls
,
*
args
,
**
kwds
):
def
__new__
(
cls
,
*
args
,
**
kwds
):
return
super
(
MyProxy2
,
cls
).
__new__
(
cls
,
'value'
)
return
super
(
MyProxy2
,
cls
).
__new__
(
cls
,
'value'
)
p
=
MyProxy2
(
'splat!'
)
p
roxy
=
MyProxy2
(
'splat!'
)
self
.
assertEqual
(
list
(
p
),
list
(
'splat!'
))
self
.
assertEqual
(
list
(
p
roxy
),
list
(
'splat!'
))
class
MyProxy3
(
MyProxy2
):
class
MyProxy3
(
MyProxy2
):
def
__init__
(
self
,
arg
):
def
__init__
(
self
,
arg
):
...
@@ -72,14 +72,14 @@ class PyProxyBaseTestCase(unittest.TestCase):
...
@@ -72,14 +72,14 @@ class PyProxyBaseTestCase(unittest.TestCase):
raise
AssertionError
(
"list(self) != list('value')"
)
raise
AssertionError
(
"list(self) != list('value')"
)
super
(
MyProxy3
,
self
).
__init__
(
'another'
)
super
(
MyProxy3
,
self
).
__init__
(
'another'
)
p
=
MyProxy3
(
'notused'
)
p
roxy
=
MyProxy3
(
'notused'
)
self
.
assertEqual
(
list
(
p
),
list
(
'another'
))
self
.
assertEqual
(
list
(
p
roxy
),
list
(
'another'
))
def
test___call__
(
self
):
def
test___call__
(
self
):
def
_foo
():
def
_foo
():
return
'FOO'
return
'FOO'
p
=
self
.
_makeOne
(
_foo
)
p
roxy
=
self
.
_makeOne
(
_foo
)
self
.
assertEqual
(
p
(),
'FOO'
)
self
.
assertEqual
(
p
roxy
(),
'FOO'
)
def
test_callable
(
self
):
def
test_callable
(
self
):
from
zope.proxy._compat
import
PY3
from
zope.proxy._compat
import
PY3
...
@@ -90,14 +90,14 @@ class PyProxyBaseTestCase(unittest.TestCase):
...
@@ -90,14 +90,14 @@ class PyProxyBaseTestCase(unittest.TestCase):
def
test___repr__
(
self
):
def
test___repr__
(
self
):
def
_foo
():
def
_foo
():
return
'FOO'
return
'FOO'
p
=
self
.
_makeOne
(
_foo
)
p
roxy
=
self
.
_makeOne
(
_foo
)
self
.
assertTrue
(
repr
(
p
).
startswith
(
'<function _foo'
))
self
.
assertTrue
(
repr
(
p
roxy
).
startswith
(
'<function _foo'
))
def
test___str__
(
self
):
def
test___str__
(
self
):
def
_foo
():
def
_foo
():
return
'FOO'
return
'FOO'
p
=
self
.
_makeOne
(
_foo
)
p
roxy
=
self
.
_makeOne
(
_foo
)
self
.
assertTrue
(
str
(
p
).
startswith
(
'<function _foo'
))
self
.
assertTrue
(
str
(
p
roxy
).
startswith
(
'<function _foo'
))
def
test___unicode__
(
self
):
def
test___unicode__
(
self
):
from
zope.proxy._compat
import
PY3
from
zope.proxy._compat
import
PY3
...
@@ -105,8 +105,8 @@ class PyProxyBaseTestCase(unittest.TestCase):
...
@@ -105,8 +105,8 @@ class PyProxyBaseTestCase(unittest.TestCase):
return
return
def
_foo
():
def
_foo
():
return
'FOO'
return
'FOO'
p
=
self
.
_makeOne
(
_foo
)
p
roxy
=
self
.
_makeOne
(
_foo
)
self
.
assertTrue
(
unicode
(
p
).
startswith
(
'<function _foo'
))
self
.
assertTrue
(
unicode
(
p
roxy
).
startswith
(
'<function _foo'
))
def
test___reduce___via_pickling
(
self
):
def
test___reduce___via_pickling
(
self
):
import
pickle
import
pickle
...
@@ -582,16 +582,16 @@ class Test_py_getProxiedObject(unittest.TestCase):
...
@@ -582,16 +582,16 @@ class Test_py_getProxiedObject(unittest.TestCase):
class
C
(
object
):
class
C
(
object
):
pass
pass
c
=
C
()
c
=
C
()
p
=
self
.
_makeProxy
(
c
)
p
roxy
=
self
.
_makeProxy
(
c
)
self
.
assertTrue
(
self
.
_callFUT
(
p
)
is
c
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy
)
is
c
)
def
test_nested_proxy
(
self
):
def
test_nested_proxy
(
self
):
class
C
(
object
):
class
C
(
object
):
pass
pass
c
=
C
()
c
=
C
()
p
=
self
.
_makeProxy
(
c
)
p
roxy
=
self
.
_makeProxy
(
c
)
p
2
=
self
.
_makeProxy
(
p
)
p
roxy2
=
self
.
_makeProxy
(
proxy
)
self
.
assertTrue
(
self
.
_callFUT
(
p
2
)
is
p
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy2
)
is
proxy
)
class
Test_getProxiedObject
(
Test_py_getProxiedObject
):
class
Test_getProxiedObject
(
Test_py_getProxiedObject
):
...
@@ -628,11 +628,11 @@ class Test_py_setProxiedObject(unittest.TestCase):
...
@@ -628,11 +628,11 @@ class Test_py_setProxiedObject(unittest.TestCase):
self
.
name
=
name
self
.
name
=
name
c1
=
C
(
'c1'
)
c1
=
C
(
'c1'
)
c2
=
C
(
'c2'
)
c2
=
C
(
'c2'
)
p
=
self
.
_makeProxy
(
c1
)
p
roxy
=
self
.
_makeProxy
(
c1
)
self
.
assertEqual
(
p
.
name
,
'c1'
)
self
.
assertEqual
(
p
roxy
.
name
,
'c1'
)
old
=
self
.
_callFUT
(
p
,
c2
)
old
=
self
.
_callFUT
(
p
roxy
,
c2
)
self
.
assertTrue
(
old
is
c1
)
self
.
assertTrue
(
old
is
c1
)
self
.
assertEqual
(
p
.
name
,
'c2'
)
self
.
assertEqual
(
p
roxy
.
name
,
'c2'
)
def
test_w_nested_proxy
(
self
):
def
test_w_nested_proxy
(
self
):
class
C
(
object
):
class
C
(
object
):
...
@@ -641,12 +641,12 @@ class Test_py_setProxiedObject(unittest.TestCase):
...
@@ -641,12 +641,12 @@ class Test_py_setProxiedObject(unittest.TestCase):
c1
=
C
(
'c1'
)
c1
=
C
(
'c1'
)
c2
=
C
(
'c2'
)
c2
=
C
(
'c2'
)
p1
=
self
.
_makeProxy
(
c1
)
p1
=
self
.
_makeProxy
(
c1
)
p2
=
self
.
_makeProxy
(
c2
)
p
roxy
2
=
self
.
_makeProxy
(
c2
)
p
=
self
.
_makeProxy
(
p1
)
p
roxy
=
self
.
_makeProxy
(
p1
)
self
.
assertEqual
(
p
.
name
,
'c1'
)
self
.
assertEqual
(
p
roxy
.
name
,
'c1'
)
old
=
self
.
_callFUT
(
p
,
p
2
)
old
=
self
.
_callFUT
(
p
roxy
,
proxy
2
)
self
.
assertTrue
(
old
is
p1
)
self
.
assertTrue
(
old
is
p1
)
self
.
assertEqual
(
p
.
name
,
'c2'
)
self
.
assertEqual
(
p
roxy
.
name
,
'c2'
)
class
Test_setProxiedObject
(
Test_py_setProxiedObject
):
class
Test_setProxiedObject
(
Test_py_setProxiedObject
):
...
@@ -916,11 +916,11 @@ class Test_py_queryInnerProxy(unittest.TestCase):
...
@@ -916,11 +916,11 @@ class Test_py_queryInnerProxy(unittest.TestCase):
pass
pass
c
=
C
()
c
=
C
()
p1
=
P1
(
c
)
p1
=
P1
(
c
)
p2
=
P2
(
p1
)
p
roxy
2
=
P2
(
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p2
,
P1
)
is
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy
2
,
P1
)
is
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p2
,
P1
,
42
)
is
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy
2
,
P1
,
42
)
is
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p
2
,
P2
)
is
p
2
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy2
,
P2
)
is
proxy
2
)
self
.
assertTrue
(
self
.
_callFUT
(
p
2
,
P2
,
42
)
is
p
2
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy2
,
P2
,
42
)
is
proxy
2
)
def
test_re_nested_proxy
(
self
):
def
test_re_nested_proxy
(
self
):
class
P1
(
self
.
_proxyClass
()):
class
P1
(
self
.
_proxyClass
()):
...
@@ -931,12 +931,12 @@ class Test_py_queryInnerProxy(unittest.TestCase):
...
@@ -931,12 +931,12 @@ class Test_py_queryInnerProxy(unittest.TestCase):
pass
pass
c
=
C
()
c
=
C
()
p1
=
P1
(
c
)
p1
=
P1
(
c
)
p2
=
P2
(
p1
)
p
roxy
2
=
P2
(
p1
)
p
3
=
P1
(
p
2
)
p
roxy3
=
P1
(
proxy
2
)
self
.
assertTrue
(
self
.
_callFUT
(
p3
,
P1
)
is
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy
3
,
P1
)
is
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p3
,
P1
,
42
)
is
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy
3
,
P1
,
42
)
is
p1
)
self
.
assertTrue
(
self
.
_callFUT
(
p
3
,
P2
)
is
p
2
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy3
,
P2
)
is
proxy
2
)
self
.
assertTrue
(
self
.
_callFUT
(
p
3
,
P2
,
42
)
is
p
2
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy3
,
P2
,
42
)
is
proxy
2
)
class
Test_queryInnerProxy
(
unittest
.
TestCase
):
class
Test_queryInnerProxy
(
unittest
.
TestCase
):
...
@@ -970,16 +970,16 @@ class Test_py_removeAllProxies(unittest.TestCase):
...
@@ -970,16 +970,16 @@ class Test_py_removeAllProxies(unittest.TestCase):
class
C
(
object
):
class
C
(
object
):
pass
pass
c
=
C
()
c
=
C
()
p
=
self
.
_makeProxy
(
c
)
p
roxy
=
self
.
_makeProxy
(
c
)
self
.
assertTrue
(
self
.
_callFUT
(
p
)
is
c
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy
)
is
c
)
def
test_nested_proxy
(
self
):
def
test_nested_proxy
(
self
):
class
C
(
object
):
class
C
(
object
):
pass
pass
c
=
C
()
c
=
C
()
p
=
self
.
_makeProxy
(
c
)
p
roxy
=
self
.
_makeProxy
(
c
)
p
2
=
self
.
_makeProxy
(
p
)
p
roxy2
=
self
.
_makeProxy
(
proxy
)
self
.
assertTrue
(
self
.
_callFUT
(
p2
)
is
c
)
self
.
assertTrue
(
self
.
_callFUT
(
p
roxy
2
)
is
c
)
class
Test_removeAllProxies
(
unittest
.
TestCase
):
class
Test_removeAllProxies
(
unittest
.
TestCase
):
...
@@ -1010,19 +1010,20 @@ class Test_ProxyIterator(unittest.TestCase):
...
@@ -1010,19 +1010,20 @@ class Test_ProxyIterator(unittest.TestCase):
class
C
(
object
):
class
C
(
object
):
pass
pass
c
=
C
()
c
=
C
()
p
=
ProxyBase
(
c
)
p
roxy
=
ProxyBase
(
c
)
self
.
assertEqual
(
list
(
self
.
_callFUT
(
p
)),
[
p
,
c
])
self
.
assertEqual
(
list
(
self
.
_callFUT
(
p
roxy
)),
[
proxy
,
c
])
def
test_w_nested_proxies
(
self
):
def
test_w_nested_proxies
(
self
):
from
zope.proxy
import
ProxyBase
from
zope.proxy
import
ProxyBase
class
C
(
object
):
class
C
(
object
):
pass
pass
c
=
C
()
c
=
C
()
p
=
ProxyBase
(
c
)
proxy
=
ProxyBase
(
c
)
p2
=
ProxyBase
(
p
)
proxy2
=
ProxyBase
(
proxy
)
p3
=
ProxyBase
(
p2
)
proxy3
=
ProxyBase
(
proxy2
)
p4
=
ProxyBase
(
p3
)
proxy4
=
ProxyBase
(
proxy3
)
self
.
assertEqual
(
list
(
self
.
_callFUT
(
p4
)),
[
p4
,
p3
,
p2
,
p
,
c
])
self
.
assertEqual
(
list
(
self
.
_callFUT
(
proxy4
)),
[
proxy4
,
proxy3
,
proxy2
,
proxy
,
c
])
class
Test_nonOverridable
(
unittest
.
TestCase
):
class
Test_nonOverridable
(
unittest
.
TestCase
):
...
...
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