MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_set_get_delete

Method test_set_get_delete

test/test_comments.py:117–127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

115
116class TestApi:
117 def test_set_get_delete(self):
118 bx = Box(a=1, b={"c": 2})
119 bx.set_comment("a", "eol text")
120 bx.set_comment("a", "line one\nline two", position="before")
121 bx.b.set_comment("c", "nested")
122 assert bx.get_comment("a") == {"eol": "eol text", "before": "line one\nline two"}
123 assert bx.to_yaml() == "# line one\n# line two\na: 1 # eol text\nb:\n c: 2 # nested\n"
124 bx.del_comment("a")
125 assert bx.get_comment("a") is None
126 bx.set_comment("b", "") # empty text removes that position
127 assert bx.get_comment("b") is None
128
129 def test_remove_one_position(self):
130 bx = Box(a=1)

Callers

nothing calls this directly

Calls 5

set_commentMethod · 0.95
get_commentMethod · 0.95
to_yamlMethod · 0.95
del_commentMethod · 0.95
BoxClass · 0.90

Tested by

no test coverage detected