def test_can_hydrate_node_structure(self): struct = Structure(3, b'N') struct.append("node/123") struct.append(["Person"]) struct.append({"name": "Alice"}) alice = hydrated(struct) assert alice.identity == "node/123" assert alice.labels == {"Person"} assert set(alice.keys()) == {"name"} assert alice.get("name") == "Alice"
def test_can_hydrate_in_dict(self): struct = Structure(3, b'N') struct.append("node/123") struct.append(["Person"]) struct.append({"name": "Alice"}) alice_in_dict = hydrated({"foo": struct}) assert isinstance(alice_in_dict, dict) alice = alice_in_dict["foo"] assert alice.identity == "node/123" assert alice.labels == {"Person"} assert set(alice.keys()) == {"name"} assert alice.get("name") == "Alice"
def test_hydrating_unknown_structure_returns_same(self): struct = Structure(1, b'X') struct.append("foo") mystery = hydrated(struct) assert mystery == struct