Darthbhyrava has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/276752

Change subject: Change: imageharvest and panoramiopicker should use bs4 instead 
of BeautifulSoup v3
......................................................................

Change: imageharvest and panoramiopicker should use bs4 instead of 
BeautifulSoup v3

Change necessary scripts in scripts/ and tests/ to ensure imageharvest and 
panoramiopicker use Beatiful Soup v4 instead of v3

Bug: T115428
Change-Id: I5f724dedfbbaf486a0d1cd64b77523a12a958bd5
---
M scripts/imageharvest.py
M scripts/panoramiopicker.py
A tests/panoramiopicker_tests.py
M tests/script_tests.py
4 files changed, 34 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/52/276752/1

diff --git a/scripts/imageharvest.py b/scripts/imageharvest.py
index 6e5e366..9fe43bb 100644
--- a/scripts/imageharvest.py
+++ b/scripts/imageharvest.py
@@ -26,7 +26,7 @@
 
 import os
 
-import BeautifulSoup
+from bs4 import BeautifulSoup
 
 import pywikibot
 
@@ -48,7 +48,7 @@
     links = []
     uo = URLopener()
     file = uo.open(url)
-    soup = BeautifulSoup.BeautifulSoup(file.read())
+    soup = BeautifulSoup(file.read())
     file.close()
     if not shown:
         tagname = "a"
diff --git a/scripts/panoramiopicker.py b/scripts/panoramiopicker.py
index a971687..a019ae1 100644
--- a/scripts/panoramiopicker.py
+++ b/scripts/panoramiopicker.py
@@ -18,7 +18,7 @@
 import socket
 import StringIO
 
-from BeautifulSoup import BeautifulSoup
+from bs4 import BeautifulSoup
 
 import pywikibot
 
diff --git a/tests/panoramiopicker_tests.py b/tests/panoramiopicker_tests.py
new file mode 100644
index 0000000..1ae8c19
--- /dev/null
+++ b/tests/panoramiopicker_tests.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+"""Test methods in panoramiopicker script."""
+#
+# (C) Pywikibot team, 2016
+#
+# Distributed under the terms of the MIT license.
+#
+from __future__ import absolute_import, unicode_literals
+__version__ = '$Id'
+
+from scripts import panoramiopicker
+
+from tests.aspects import unittest, TestCase
+
+
+class TestPanoramioMethods(TestCase):
+
+    """Test methods in panoramiopicker."""
+
+    def test_getLicense(self):
+        """Test getLicense() method."""
+        x = panoramiopicker.getPhotos(photoset=u'public', start_id='0', 
end_id='5')
+        for photoinfo in x:
+            photoinfo = panoramiopicker.getLicense(photoinfo)
+            self.assertEqual(photoinfo['license'], u'by-sa')
+
+
+if __name__ == "__main__":
+    unittest.main()
diff --git a/tests/script_tests.py b/tests/script_tests.py
index 4fdd9ec..a9207cd 100644
--- a/tests/script_tests.py
+++ b/tests/script_tests.py
@@ -42,9 +42,9 @@
     # Note: package 'lunatic-python' provides module 'lua'
 
     'flickrripper': ['flickrapi'],
-    'imageharvest': ['BeautifulSoup'],
+    'imageharvest': ['BeautifulSoup4'],
     'match_images': ['PIL.ImageTk'],
-    'panoramiopicker': ['BeautifulSoup'],
+    'panoramiopicker': ['BeautifulSoup4'],
     'states_redirect': ['pycountry'],
     'patrol': ['mwparserfromhell'],
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/276752
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f724dedfbbaf486a0d1cd64b77523a12a958bd5
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Darthbhyrava <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to