def test_can_cast_node(self): alice = Node(name="Alice") self.graph.create(alice) casted = cast(alice) assert isinstance(casted, Node) assert remote(casted) assert casted["name"] == "Alice"
def test_can_cast_3_tuple(self): alice = Node() bob = Node() casted = cast((alice, "KNOWS", bob)) assert isinstance(casted, Relationship) assert not remote(casted) assert casted.start_node() is alice assert casted.type() == "KNOWS" assert casted.end_node() is bob
def test_can_cast_rel(self): a = Node() b = Node() ab = Relationship(a, "KNOWS", b) self.graph.create(ab) casted = cast(ab) assert isinstance(casted, Relationship) assert remote(casted) assert casted.start_node() == a assert casted.type() == "KNOWS" assert casted.end_node() == b
def test_can_cast_dict(self): casted = cast({"name": "Alice"}) assert isinstance(casted, Node) assert not remote(casted) assert casted["name"] == "Alice"
def test_cast(self): assert cast(None) is None