Example #1
0
 def test_type_and_adr_w_oid(self):
     from BTrees.utils import oid_repr
     class WithOid(object):
         _p_oid = b'DEADBEEF'
     t_and_a = self._callFUT(WithOid())
     self.assertTrue(t_and_a.startswith('WithOid (0x'))
     self.assertTrue(t_and_a.endswith('oid=%s)' % oid_repr(b'DEADBEEF')))
Example #2
0
    def test_type_and_adr_w_oid(self):
        from BTrees.utils import oid_repr

        class WithOid(object):
            _p_oid = b'DEADBEEF'

        t_and_a = self._callFUT(WithOid())
        self.assertTrue(t_and_a.startswith('WithOid (0x'))
        self.assertTrue(t_and_a.endswith('oid=%s)' % oid_repr(b'DEADBEEF')))
def type_and_adr(obj):
    if hasattr(obj, '_p_oid'):
        oid = oid_repr(obj._p_oid)
    else:
        oid = 'None'
    return "%s (0x%x oid=%s)" % (type(obj).__name__, positive_id(obj), oid)
Example #4
0
 def _callFUT(self, oid):
     from BTrees.utils import oid_repr
     return oid_repr(oid)
Example #5
0
def type_and_adr(obj):
    if hasattr(obj, '_p_oid'):
        oid = oid_repr(obj._p_oid)
    else:
        oid = 'None'
    return "%s (0x%x oid=%s)" % (type(obj).__name__, positive_id(obj), oid)
Example #6
0
 def _callFUT(self, oid):
     from BTrees.utils import oid_repr
     return oid_repr(oid)