def __init__(self, source_proxy, target_proxy): self._src_prx = source_proxy self._tgt_prx = target_proxy self.__trv_path = TraversalPath() self.__root_is_sequence = \ (not source_proxy is None and source_proxy.proxy_for == RESOURCE_KINDS.COLLECTION) \ or (not target_proxy is None and target_proxy.proxy_for == RESOURCE_KINDS.COLLECTION) if __debug__: self.__logger = get_logger('everest.traversal') else: self.__logger = None
def test_basics(self): tp = TraversalPath() self.assert_equal(len(tp), 0) self.assert_is_none(tp.parent) self.assert_is_none(tp.relation_operation) parent = 'proxy' attr = 'attribute' key = ('source', 'target') rel_op = 'relation_operation' tp.push(parent, key, attr, rel_op) self.assert_equal(len(tp), 1) self.assert_true(key in tp) self.assert_equal(tp.parent, parent) self.assert_equal(tp.relation_operation, rel_op) tp.pop() self.assert_equal(len(tp), 0) self.assert_false(key in tp)