本文整理汇总了Python中py2neo.Graph.cast方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.cast方法的具体用法?Python Graph.cast怎么用?Python Graph.cast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类py2neo.Graph
的用法示例。
在下文中一共展示了Graph.cast方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_can_cast_3_tuple
# 需要导入模块: from py2neo import Graph [as 别名]
# 或者: from py2neo.Graph import cast [as 别名]
def test_can_cast_3_tuple():
casted = Graph.cast(("Alice", "KNOWS", "Bob"))
assert isinstance(casted, Relationship)
assert not casted.bound
assert casted.start_node == Node("Alice")
assert casted.type == "KNOWS"
assert casted.end_node == Node("Bob")
示例2: test_can_cast_rel
# 需要导入模块: from py2neo import Graph [as 别名]
# 或者: from py2neo.Graph import cast [as 别名]
def test_can_cast_rel(graph):
a, b, ab = graph.create({}, {}, (0, "KNOWS", 1))
casted = Graph.cast(ab)
assert isinstance(casted, Relationship)
assert casted.bound
assert casted.start_node == a
assert casted.type == "KNOWS"
assert casted.end_node == b
示例3: test_can_cast_dict
# 需要导入模块: from py2neo import Graph [as 别名]
# 或者: from py2neo.Graph import cast [as 别名]
def test_can_cast_dict():
casted = Graph.cast({"name": "Alice"})
assert isinstance(casted, Node)
assert not casted.bound
assert casted["name"] == "Alice"
示例4: test_can_cast_node
# 需要导入模块: from py2neo import Graph [as 别名]
# 或者: from py2neo.Graph import cast [as 别名]
def test_can_cast_node(graph):
alice, = graph.create({"name": "Alice"})
casted = Graph.cast(alice)
assert isinstance(casted, Node)
assert casted.bound
assert casted["name"] == "Alice"