本文整理匯總了Python中majormajor.changeset.Changeset.has_ancestor方法的典型用法代碼示例。如果您正苦於以下問題:Python Changeset.has_ancestor方法的具體用法?Python Changeset.has_ancestor怎麽用?Python Changeset.has_ancestor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類majormajor.changeset.Changeset
的用法示例。
在下文中一共展示了Changeset.has_ancestor方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_has_ancestor
# 需要導入模塊: from majormajor.changeset import Changeset [as 別名]
# 或者: from majormajor.changeset.Changeset import has_ancestor [as 別名]
def test_has_ancestor(self):
"""
Some complex tree.
C -- G -- H -------- K
/ / \
A -- B -- D -- F -- J -- L -- M--
\ /
E --- I
"""
doc_id = 'dummy'
root = Changeset(doc_id, "user0", [])
assert not root.has_ancestor(self.cs0)
A = Changeset(doc_id, "user0", [root])
assert A.has_ancestor(root)
assert not A.has_ancestor(self.cs0)
B = Changeset(doc_id,"user1",[A])
assert B.has_ancestor(A)
assert B.has_ancestor(root)
C = Changeset(doc_id,"user3",[B])
assert C.has_ancestor(root)
assert C.has_ancestor(A)
assert C.has_ancestor(B)
D = Changeset(doc_id,"user4",[B])
assert D.has_ancestor(root)
assert D.has_ancestor(A)
assert D.has_ancestor(B)
assert not D.has_ancestor(C)
E = Changeset(doc_id,"user5",[D])
assert E.has_ancestor(root)
assert E.has_ancestor(A)
assert E.has_ancestor(B)
assert E.has_ancestor(D)
assert not E.has_ancestor(C)
F = Changeset(doc_id,"user6",[D])
assert F.has_ancestor(root)
assert F.has_ancestor(A)
assert F.has_ancestor(B)
assert F.has_ancestor(D)
assert not F.has_ancestor(C)
assert not F.has_ancestor(E)
G = Changeset(doc_id,"user5",[C])
assert G.has_ancestor(root)
assert G.has_ancestor(A)
assert G.has_ancestor(B)
assert G.has_ancestor(C)
assert not G.has_ancestor(D)
assert not G.has_ancestor(E)
assert not G.has_ancestor(F)
H = Changeset(doc_id,"user5",[G,F])
assert H.has_ancestor(root)
assert H.has_ancestor(A)
assert H.has_ancestor(B)
assert H.has_ancestor(C)
assert H.has_ancestor(G)
assert H.has_ancestor(D)
assert not H.has_ancestor(E)
assert H.has_ancestor(F)
I = Changeset(doc_id,"user6",[E])
assert I.has_ancestor(root)
assert I.has_ancestor(A)
assert I.has_ancestor(B)
assert not I.has_ancestor(C)
assert I.has_ancestor(D)
assert I.has_ancestor(E)
assert not I.has_ancestor(F)
assert not I.has_ancestor(G)
assert not I.has_ancestor(H)
J = Changeset(doc_id,"user5",[I,F])
assert J.has_ancestor(root)
assert J.has_ancestor(A)
assert J.has_ancestor(B)
assert not J.has_ancestor(C)
assert J.has_ancestor(D)
assert J.has_ancestor(E)
assert J.has_ancestor(F)
assert not J.has_ancestor(G)
assert not J.has_ancestor(H)
assert J.has_ancestor(I)
K = Changeset(doc_id,"user5",[H])
assert K.has_ancestor(root)
assert K.has_ancestor(A)
assert K.has_ancestor(B)
assert K.has_ancestor(C)
assert K.has_ancestor(D)
assert not K.has_ancestor(E)
#.........這裏部分代碼省略.........