def test_add_node(): root = _create_filled_tree() sub_node = StructuredDataNode() sub_node.add_attributes({"sn0": "SN 0", "sn1": "SN 1"}) sub_node.add_table([ { "sn0": "SN 00", "sn1": "SN 01" }, { "sn0": "SN 10", "sn1": "SN 11" }, ]) node = root.get_node(["path", "to", "nta"]).add_node("node", sub_node) # Do not modify orig node. assert sub_node.attributes.path == tuple() assert sub_node.table.path == tuple() assert sub_node.path == tuple() assert node.attributes.path == tuple(["path", "to", "nta", "node"]) assert node.table.path == tuple(["path", "to", "nta", "node"]) assert node.path == tuple(["path", "to", "nta", "node"]) assert not root.is_empty() assert root.count_entries() == 18
def test_add_attributes(): path = ("path-to", "node") retentions = {"key": RetentionIntervals(1, 2, 3)} node = StructuredDataNode(name="node", path=path) attributes = Attributes(retentions=retentions) node.add_attributes(attributes) assert node.attributes.path == path assert node.attributes.retentions == retentions