diff options
author | Marius Gedminas <marius@gedmin.as> | 2014-01-09 20:13:17 +0200 |
---|---|---|
committer | Marius Gedminas <marius@gedmin.as> | 2014-01-09 20:13:17 +0200 |
commit | 01f798705f7dae5fcc82274099ec8d0d8f78b873 (patch) | |
tree | 649572c7dfd0045363f15d089f77f9e14f8f83b3 | |
parent | 45e8a8563dcbc82c615fb4c52aad067735580443 (diff) | |
download | zope-security-01f798705f7dae5fcc82274099ec8d0d8f78b873.tar.gz |
Merge the two duplicated _fmt_address()
-rw-r--r-- | src/zope/security/proxy.py | 2 | ||||
-rw-r--r-- | src/zope/security/tests/test_proxy.py | 11 |
2 files changed, 3 insertions, 10 deletions
diff --git a/src/zope/security/proxy.py b/src/zope/security/proxy.py index 7f7d626..16bb95f 100644 --- a/src/zope/security/proxy.py +++ b/src/zope/security/proxy.py @@ -52,7 +52,7 @@ def _fmt_address(obj): # the platform sprintf(buf, "%p", obj), which we cannot access from Python # directly (and ctypes seems like overkill). if sys.platform == 'win32': - return '0x%08x' % id(obj) + return '0x%08X' % id(obj) else: return '0x%0x' % id(obj) diff --git a/src/zope/security/tests/test_proxy.py b/src/zope/security/tests/test_proxy.py index d2e1dbc..fbe4964 100644 --- a/src/zope/security/tests/test_proxy.py +++ b/src/zope/security/tests/test_proxy.py @@ -36,15 +36,6 @@ def _skip_if_Py2(testfunc): return dummy return testfunc -def _fmt_address(obj): - # Try to replicate PyString_FromString("%p", obj), which actually uses - # the platform sprintf(buf, "%p", obj), which we cannot access from Python - # directly (and ctypes seems like overkill). - if sys.platform == 'win32': - return '0x%08X' % id(obj) - else: - return '0x%0x' % id(obj) - class ProxyTestBase(object): @@ -160,6 +151,7 @@ class ProxyTestBase(object): def test___str___checker_forbids_str(self): from zope.security.interfaces import ForbiddenAttribute from zope.security._compat import _BUILTINS + from zope.security.proxy import _fmt_address target = object() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) @@ -177,6 +169,7 @@ class ProxyTestBase(object): def test___repr___checker_forbids_str(self): from zope.security.interfaces import ForbiddenAttribute from zope.security._compat import _BUILTINS + from zope.security.proxy import _fmt_address target = object() checker = DummyChecker(ForbiddenAttribute) proxy = self._makeOne(target, checker) |