GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — schema: add store_only parameter to parse_data_dict · CESNET/libyang-python@1afc2a6

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • libyang
    • schema.py
  • tests
    • test_data.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎libyang/schema.py‎

Copy file name to clipboardExpand all lines: libyang/schema.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ def parse_data_dict(
241241
rpc: bool = False,
242242
rpcreply: bool = False,
243243
notification: bool = False,
244+
store_only: bool = False,
244245
) -> "libyang.data.DNode":
245246
"""
246247
Convert a python dictionary to a DNode object following the schema of this
@@ -276,6 +277,7 @@ def parse_data_dict(
276277
rpc=rpc,
277278
rpcreply=rpcreply,
278279
notification=notification,
280+
store_only=store_only,
279281
)
280282

281283

Collapse file

‎tests/test_data.py‎

Copy file name to clipboardExpand all lines: tests/test_data.py
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,3 +1112,22 @@ def test_dnode_builtin_plugins_only(self):
11121112
self.assertIsInstance(dnode, DLeaf)
11131113
self.assertEqual(dnode.value(), "test")
11141114
dnode.free()
1115+
1116+
def test_merge_store_only(self):
1117+
MAIN = {"yolo-nodetypes:test1": 50}
1118+
module = self.ctx.load_module("yolo-nodetypes")
1119+
dnode = module.parse_data_dict(MAIN, validate=False, store_only=True)
1120+
self.assertIsInstance(dnode, DLeaf)
1121+
self.assertEqual(dnode.value(), 50)
1122+
dnode.free()
1123+
1124+
def test_merge_builtin_plugins_only(self):
1125+
MAIN = {"yolo-nodetypes:ip-address": "test"}
1126+
self.tearDown()
1127+
gc.collect()
1128+
self.ctx = Context(YANG_DIR, builtin_plugins_only=True)
1129+
module = self.ctx.load_module("yolo-nodetypes")
1130+
dnode = module.parse_data_dict(MAIN, validate=False, store_only=True)
1131+
self.assertIsInstance(dnode, DLeaf)
1132+
self.assertEqual(dnode.value(), "test")
1133+
dnode.free()

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.