jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1319811?usp=email )

Change subject: tests: add editor_tests.py to pywikibot.tests
......................................................................

tests: add editor_tests.py to pywikibot.tests

Change-Id: I8a4e7f5f31c0794b42b2a1b5a70096800ba17468
---
A tests/editor_tests.py
1 file changed, 57 insertions(+), 0 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




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 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1319811?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I8a4e7f5f31c0794b42b2a1b5a70096800ba17468
Gerrit-Change-Number: 1319811
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to