jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/610307 )

Change subject: [tests] Additional date tests: test month names lookup
......................................................................

[tests] Additional date tests: test month names lookup

test detached from 3b2b594826f1180c204b3d324560fd2b1c19ab40

Change-Id: I04e4d111a8f0a7ae90c858f715aa75e28d75ef48
---
M tests/date_tests.py
1 file changed, 30 insertions(+), 0 deletions(-)

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



diff --git a/tests/date_tests.py b/tests/date_tests.py
index 5308049..cac5ad1 100644
--- a/tests/date_tests.py
+++ b/tests/date_tests.py
@@ -65,6 +65,36 @@
     net = False


+class TestMonthName(TestCase):
+
+    """Test MonthName format."""
+
+    net = True
+
+    def test_month_name_formats(self):
+        """Test MonthName format."""
+        formatname = 'MonthName'
+        for code in date.formats['Cat_BirthsAD']:
+            try:
+                convert = date.formats[formatname][code]
+            except KeyError:  # Not all month names are available yet
+                continue
+            predicate, start, stop = date.formatLimits[formatname]
+            for value in range(start, stop):
+                with self.subTest(code=code, month=value):
+                    self.assertTrue(
+                        predicate(value),
+                        "date.formats['{}']['{}']:\ninvalid value {}"
+                        .format(formatname, code, value))
+
+                    new_value = convert(convert(value))
+                    self.assertEqual(
+                        new_value, value,
+                        "date.formats['{}']['{}']:\n"
+                        'value {} does not match {}'
+                        .format(formatname, code, new_value, value))
+
+
 class TestMonthDelta(TestCase):

     """Tests for adding months to a date and getting the months between two."""

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/610307
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I04e4d111a8f0a7ae90c858f715aa75e28d75ef48
Gerrit-Change-Number: 610307
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to