本文整理汇总了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)
#.........这里部分代码省略.........