jenkins-bot submitted this change.
tests: add editor_tests.py to pywikibot.tests
Change-Id: I8a4e7f5f31c0794b42b2a1b5a70096800ba17468
---
A tests/editor_tests.py
1 file changed, 57 insertions(+), 0 deletions(-)
diff --git a/tests/editor_tests.py b/tests/editor_tests.py
new file mode 100755
index 0000000..1d7350f
--- /dev/null
+++ b/tests/editor_tests.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python3
+#
+# (C) Pywikibot team, 2026
+#
+# Distributed under the terms of the MIT license.
+#
+"""Tests for :mod:`editor` module."""
+from __future__ import annotations
+
+import unittest
+from contextlib import suppress
+
+from pywikibot import config, editor
+from tests.aspects import TestCase
+
+
+class EditorTestCase(TestCase):
+
+ """Test for editor.Texteditor."""
+
+ net = False
+
+ def setUp(self):
+ """Save editor setting."""
+ self.old_editor = config.editor
+
+ def tearDown(self):
+ """Restore editor setting."""
+ config.editor = self.old_editor
+
+ def test_editor_default(self):
+ """Test editor with default config setting."""
+ te = editor.TextEditor()
+ self.assertEqual(te.editor, '')
+
+ def test_editor_true(self):
+ """Test editor with config.editor set to True."""
+ config.editor = True
+ te = editor.TextEditor()
+ self.assertEqual(te.editor, '')
+
+ def test_editor_false(self):
+ """Test editor with config.editor set to False."""
+ config.editor = False
+ te = editor.TextEditor()
+ self.assertEqual(te.editor, 'break' if editor.OSWIN32 else 'true')
+
+ def test_editor_editor(self):
+ """Test editor with config.editor set to True."""
+ config.editor = 'custom_editor'
+ te = editor.TextEditor()
+ self.assertEqual(te.editor, 'custom_editor')
+
+
+if __name__ == '__main__':
+ with suppress(SystemExit):
+ unittest.main()
To view, visit change 1319811. To unsubscribe, or for help writing mail filters, visit settings.