(self)
| 298 | class TemporarySetting(unittest.TestCase): |
| 299 | |
| 300 | def test_basics(self) -> None: |
| 301 | v = sublime.active_window().active_view() |
| 302 | s = v.settings() |
| 303 | key = "__some_setting_that_should_not_exist__" |
| 304 | with temporary_setting(s, key, "hello"): |
| 305 | # The value should be modified while in the with-context |
| 306 | self.assertEqual(s.get(key), "hello") |
| 307 | # The key should be erased once out of the with-context, because it was not present before. |
| 308 | self.assertFalse(s.has(key)) |
| 309 | s.set(key, "hello there") |
| 310 | with temporary_setting(s, key, "general kenobi"): |
| 311 | # value key should be modified while in the with-context |
| 312 | self.assertEqual(s.get(key), "general kenobi") |
| 313 | # The key should remain present, and the value should be restored. |
| 314 | self.assertEqual(s.get(key), "hello there") |
| 315 | s.erase(key) |
nothing calls this directly
no test coverage detected