jenkins-bot has submitted this change and it was merged.
Change subject: Add ID and/or licence information ......................................................................
Add ID and/or licence information
Change-Id: Ibf2e315622078742070ddea8edd9ef49519426a6 --- M tests/dry_api_tests.py M tests/dry_site_tests.py M tests/utils.py M tests/wikidataquery_tests.py 4 files changed, 62 insertions(+), 33 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/dry_api_tests.py b/tests/dry_api_tests.py index 82437af..c204d36 100644 --- a/tests/dry_api_tests.py +++ b/tests/dry_api_tests.py @@ -1,3 +1,12 @@ +# -*- coding: utf-8 -*- +# +# (C) Pywikibot team, 2012-2014 +# +# Distributed under the terms of the MIT license. +# +__version__ = '$Id$' +# + import datetime import pywikibot from pywikibot.data.api import CachedRequest @@ -6,36 +15,36 @@
class DryAPITests(unittest.TestCase):
- def setUp(self): - self.parms = {'site': pywikibot.Site('en'), - 'action': 'query', - 'meta': 'userinfo'} - self.req = CachedRequest(expiry=1, **self.parms) - self.expreq = CachedRequest(expiry=0, **self.parms) - self.diffreq = CachedRequest(expiry=1, site=pywikibot.Site('en'), action='query', meta='siteinfo') - self.diffsite = CachedRequest(expiry=1, site=pywikibot.Site('de'), action='query', meta='userinfo') - - def test_expiry_formats(self): - self.assertEqual(self.req.expiry, CachedRequest(datetime.timedelta(days=1), **self.parms).expiry) - - def test_get_cache_dir(self): - retval = self.req._get_cache_dir() - self.assertIn('apicache', retval) - - def test_create_file_name(self): - self.assertEqual(self.req._create_file_name(), self.req._create_file_name()) - self.assertEqual(self.req._create_file_name(), self.expreq._create_file_name()) - self.assertNotEqual(self.req._create_file_name(), self.diffreq._create_file_name()) - - def test_cachefile_path(self): - self.assertEqual(self.req._cachefile_path(), self.req._cachefile_path()) - self.assertEqual(self.req._cachefile_path(), self.expreq._cachefile_path()) - self.assertNotEqual(self.req._cachefile_path(), self.diffreq._cachefile_path()) - self.assertNotEqual(self.req._cachefile_path(), self.diffsite._cachefile_path()) - - def test_expired(self): - self.assertFalse(self.req._expired(datetime.datetime.now())) - self.assertTrue(self.req._expired(datetime.datetime.now() - datetime.timedelta(days=2))) - -if __name__ == '__main__': - unittest.main() + def setUp(self): + self.parms = {'site': pywikibot.Site('en'), + 'action': 'query', + 'meta': 'userinfo'} + self.req = CachedRequest(expiry=1, **self.parms) + self.expreq = CachedRequest(expiry=0, **self.parms) + self.diffreq = CachedRequest(expiry=1, site=pywikibot.Site('en'), action='query', meta='siteinfo') + self.diffsite = CachedRequest(expiry=1, site=pywikibot.Site('de'), action='query', meta='userinfo') + + def test_expiry_formats(self): + self.assertEqual(self.req.expiry, CachedRequest(datetime.timedelta(days=1), **self.parms).expiry) + + def test_get_cache_dir(self): + retval = self.req._get_cache_dir() + self.assertIn('apicache', retval) + + def test_create_file_name(self): + self.assertEqual(self.req._create_file_name(), self.req._create_file_name()) + self.assertEqual(self.req._create_file_name(), self.expreq._create_file_name()) + self.assertNotEqual(self.req._create_file_name(), self.diffreq._create_file_name()) + + def test_cachefile_path(self): + self.assertEqual(self.req._cachefile_path(), self.req._cachefile_path()) + self.assertEqual(self.req._cachefile_path(), self.expreq._cachefile_path()) + self.assertNotEqual(self.req._cachefile_path(), self.diffreq._cachefile_path()) + self.assertNotEqual(self.req._cachefile_path(), self.diffsite._cachefile_path()) + + def test_expired(self): + self.assertFalse(self.req._expired(datetime.datetime.now())) + self.assertTrue(self.req._expired(datetime.datetime.now() - datetime.timedelta(days=2))) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/dry_site_tests.py b/tests/dry_site_tests.py index 8aef5e1..d8e273e 100644 --- a/tests/dry_site_tests.py +++ b/tests/dry_site_tests.py @@ -1,3 +1,12 @@ +# -*- coding: utf-8 -*- +# +# (C) Pywikibot team, 2012-2014 +# +# Distributed under the terms of the MIT license. +# +__version__ = '$Id$' +# + import pywikibot from pywikibot.site import must_be
diff --git a/tests/utils.py b/tests/utils.py index bccf715..a37e75c 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,3 +1,11 @@ +# -*- coding: utf-8 -*- +# +# (C) Pywikibot team, 2013-2014 +# +# Distributed under the terms of the MIT license. +# +__version__ = '$Id$' +# try: # Unittest2 is a backport of python 2.7s unittest module to python 2.6 # Trying to import unittest2 has to happen first because 2.6 does have a diff --git a/tests/wikidataquery_tests.py b/tests/wikidataquery_tests.py index d8cfb66..f525b77 100644 --- a/tests/wikidataquery_tests.py +++ b/tests/wikidataquery_tests.py @@ -6,6 +6,9 @@ # (C) Pywikipedia bot team, 2013 # # Distributed under the terms of the MIT license. +# +__version__ = '$Id$' +#
import pywikibot.data.wikidataquery as query
pywikibot-commits@lists.wikimedia.org