(self)
| 115 | |
| 116 | class 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) |
nothing calls this directly
no test coverage detected