本文整理汇总了Python中sefaria.model.schema.JaggedArrayNode.has_titled_continuation方法的典型用法代码示例。如果您正苦于以下问题:Python JaggedArrayNode.has_titled_continuation方法的具体用法?Python JaggedArrayNode.has_titled_continuation怎么用?Python JaggedArrayNode.has_titled_continuation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sefaria.model.schema.JaggedArrayNode
的用法示例。
在下文中一共展示了JaggedArrayNode.has_titled_continuation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_presentation_and_default
# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import has_titled_continuation [as 别名]
def test_presentation_and_default(self):
s = SchemaNode()
s.key = "root"
s.add_title("root", "en", primary=True)
j2 = JaggedArrayNode()
j2.key = "default"
j2.default = True
j2.depth = 1
j2.sectionNames = ["Foo"]
j2.addressTypes = ["Integer"]
s.append(j2)
assert not s.has_titled_continuation()
j = JaggedArrayNode()
j.key = "child1"
j.depth = 1
j.sectionNames = ["Foo"]
j.addressTypes = ["Integer"]
j.add_title("Child 1", "en", primary=True)
j.add_title("Sweet Child", "en", presentation="alone")
j.add_title("Sweet Child of Mine", "en", presentation="both")
s.append(j)
s.validate()
assert s.has_titled_continuation()
assert s.has_numeric_continuation()
assert not j.has_titled_continuation()
assert not j2.has_titled_continuation()
assert j2.has_numeric_continuation()
assert j.has_numeric_continuation()
td = s.title_dict()
assert len(td) == 7
target = {
'root': j2,
'root, Child 1': j,
'root, Sweet Child of Mine': j,
'root Child 1': j,
'root Sweet Child of Mine': j,
'Sweet Child of Mine': j,
'Sweet Child': j,
}
assert td == target
示例2: test_default_chain
# 需要导入模块: from sefaria.model.schema import JaggedArrayNode [as 别名]
# 或者: from sefaria.model.schema.JaggedArrayNode import has_titled_continuation [as 别名]
def test_default_chain(self):
s = SchemaNode()
s.key = "root"
s.add_title("root", "en", primary=True)
s.add_title("alt root", "en")
s2 = SchemaNode()
s2.key = "default"
s2.default = True
s2.append_to(s)
j = JaggedArrayNode()
j.key = "default"
j.depth = 1
j.default = True
j.sectionNames = ["Foo"]
j.addressTypes = ["Integer"]
j.append_to(s2)
s.validate()
assert s.has_numeric_continuation()
assert s2.has_numeric_continuation()
assert j.has_numeric_continuation()
assert not s.has_titled_continuation()
assert not s2.has_titled_continuation()
assert not j.has_titled_continuation()