예제 #1
0
 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"
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
 def test_can_cast_dict(self):
     casted = cast({"name": "Alice"})
     assert isinstance(casted, Node)
     assert not remote(casted)
     assert casted["name"] == "Alice"
예제 #5
0
 def test_cast(self):
     assert cast(None) is None