jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/482505 )
Change subject: [tests] Add compat2core_tests.py ......................................................................
[tests] Add compat2core_tests.py
Bug: T193968 Change-Id: I6218a200fbee183dca97d01de9bdf49f0845e75b --- A tests/compat2core_tests.py 1 file changed, 45 insertions(+), 0 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/compat2core_tests.py b/tests/compat2core_tests.py new file mode 100644 index 0000000..a6986f4 --- /dev/null +++ b/tests/compat2core_tests.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +"""compat2core.py tests.""" +# +# (C) Pywikibot team, 2019 +# +# Distributed under the terms of the MIT license. +# +from __future__ import absolute_import, division, unicode_literals + +from pywikibot.tools import StringTypes + +import scripts.maintenance.compat2core as c2c + +from tests.aspects import unittest, TestCase + + +class Compat2CoreTests(TestCase): + + """Validate compat2core script.""" + + net = False + + def test_replacements(self): + """Test compat2core replacements.""" + for item in c2c.replacements: + self.assertEqual(len(item), 2) + self.assertIsInstance(item[0], StringTypes) + self.assertIsInstance(item[1], StringTypes) + + def test_warnings(self): + """Test compat2core warnings.""" + for item in c2c.warnings: + self.assertEqual(len(item), 2) + self.assertIsInstance(item[0], StringTypes) + self.assertIsInstance(item[1], StringTypes) + + def test_bot(self): + """Test compat2core bot.""" + bot = c2c.ConvertBot(warnonly=True) + self.assertIsNone(bot.source) + self.assertTrue(bot.warnonly) + + +if __name__ == '__main__': # pragma: no cover + unittest.main()
pywikibot-commits@lists.wikimedia.org