From 986cb953f93eee96b2581bbc91c487443fda19fa Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Sun, 12 Aug 2018 14:16:48 +0200 Subject: [PATCH] piratebay: flake8 / Python 3 compatibility --- modules/piratebay/test.py | 13 +++++++------ tools/py3-compatible.modules | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/piratebay/test.py b/modules/piratebay/test.py index 7e966bf8b0..e31cb35740 100644 --- a/modules/piratebay/test.py +++ b/modules/piratebay/test.py @@ -17,20 +17,21 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . -from weboob.tools.test import BackendTest -from weboob.capabilities.torrent import MagnetOnly - from random import choice +from weboob.capabilities.torrent import MagnetOnly +from weboob.tools.compat import basestring +from weboob.tools.test import BackendTest + class PiratebayTest(BackendTest): MODULE = 'piratebay' def test_torrent(self): # try something popular so we sometimes get a magnet-only torrent - l = list(self.backend.iter_torrents('ubuntu linux')) - if len(l): - torrent = choice(l) + torrents = list(self.backend.iter_torrents('ubuntu linux')) + if len(torrents): + torrent = choice(torrents) full_torrent = self.backend.get_torrent(torrent.id) assert torrent.name assert full_torrent.name == torrent.name diff --git a/tools/py3-compatible.modules b/tools/py3-compatible.modules index e606a8fb60..1482aac3c5 100644 --- a/tools/py3-compatible.modules +++ b/tools/py3-compatible.modules @@ -108,8 +108,9 @@ pap pariskiwi paroles2chansons parolesmania -pastebin pastealacon +pastebin +piratebay pixtoilelibre podnapisi popolemploi -- GitLab