jenkins-bot has submitted this change and it was merged.
Change subject: Revert "(bug 58943) Archivebot: create unit tests for
Timestripper"
......................................................................
Revert "(bug 58943) Archivebot: create unit tests for Timestripper"
Still a deadlock on Travis CI, even though it worked
for me locally...
This reverts commit 7393a66e1f31156b1ab8cd0cf5ceb274bf8bc027.
Change-Id: Id129e5219a9103498f06996c3462c9c6fc919487
---
D tests/timestripper_tests.py
1 file changed, 0 insertions(+), 72 deletions(-)
Approvals:
Merlijn van Deen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/timestripper_tests.py b/tests/timestripper_tests.py
deleted file mode 100644
index 12e0ff9..0000000
--- a/tests/timestripper_tests.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Tests for archivebot.py/Timestripper.
-"""
-#
-# (C) Pywikipedia bot team, 2014
-#
-# Distributed under the terms of the MIT license.
-#
-__version__ = '$Id$'
-
-
-import pywikibot
-from utils import PywikibotTestCase, unittest
-import scripts.archivebot as ab
-import re
-import datetime
-
-
-class TestTimeStripper(unittest.TestCase):
- """Test cases for Link objects"""
-
- def setUp(self):
- site = pywikibot.Site('fr', 'wikipedia')
- self.months = ab.Months(site=site)
- self.months.updateMonths(site=site)
- self.ts = ab.TimeStripper()
-
- def test_findmarker(self):
- """Test that string which is not part of text is
found"""
-
- txt = u'this is a string with a maker is @@@@already present'
- self.assertEqual(self.ts.findmarker(txt, base=u'@@',
delta='@@'),
- '@@@@@@')
-
- def test_last_match_and_replace(self):
- """Test that pattern matches the righmost item"""
-
- txtWithMatch = u'this string has one 1998, 1999 and 3000 in it'
- txtWithNoMatch = u'this string has no match'
- pat = self.ts.yearR
-
- self.assertEqual(self.ts.last_match_and_replace(txtWithMatch, pat),
- (u'this string has one @@, @@ and 3000 in it',
- {'year': u'1999'})
- )
- self.assertEqual(self.ts.last_match_and_replace(txtWithNoMatch, pat),
- (txtWithNoMatch,
- None)
- )
-
- def test_timestripper(self):
- """Test that correct date is matched"""
-
- txtMatch = u'3 février 2010 à 19:48 (CET) 7 février 2010 à 19:48 (CET)'
- txtNoMatch = u'3 March 2010 19:48 (CET) 7 March 2010 19:48 (CET)'
-
- res = datetime.datetime(2010, 2, 7, 19, 48,
- tzinfo=ab.tzoneFixedOffset(60, 'Europe/Paris'))
-
- self.assertEqual(self.ts.timestripper(txtMatch), res)
- self.assertEqual(self.ts.timestripper(txtNoMatch), None)
-
-
-if __name__ == '__main__':
- try:
- try:
- unittest.main()
- except SystemExit:
- pass
- finally:
- pywikibot.stopme()
--
To view, visit
https://gerrit.wikimedia.org/r/109466
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id129e5219a9103498f06996c3462c9c6fc919487
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: jenkins-bot <>