当前位置: 首页>>代码示例>>Python>>正文


Python Graph.cast方法代码示例

本文整理汇总了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")
开发者ID:EricEllett,项目名称:py2neo,代码行数:9,代码来源:neo4j_cast_test.py

示例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
开发者ID:EricEllett,项目名称:py2neo,代码行数:10,代码来源:neo4j_cast_test.py

示例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"
开发者ID:EricEllett,项目名称:py2neo,代码行数:7,代码来源:neo4j_cast_test.py

示例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"
开发者ID:EricEllett,项目名称:py2neo,代码行数:8,代码来源:neo4j_cast_test.py


注:本文中的py2neo.Graph.cast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。