Skip to content

Commit

Permalink
Fix tests (#903)
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaminister authored Sep 9, 2021
1 parent cb63c32 commit a61ce6d
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 21 deletions.
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ disable=
too-many-public-methods,
too-many-return-statements,
too-many-statements,
unspecified-encoding,
max-line-length=160
2 changes: 1 addition & 1 deletion resources/lib/apihelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def get_upnext(self, info):
def get_single_episode_data(self, video_id=None, whatson_id=None, video_url=None):
"""Get single episode api data by videoId, whatsonId or url"""
episode = None
api_data = list()
api_data = []
if video_id:
api_data = self.get_episodes(video_id=video_id, variety='single')
elif whatson_id:
Expand Down
1 change: 1 addition & 0 deletions resources/lib/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
dict(name='Exclusief online', id='exclusief-online', msgctxt=30100),
dict(name='Volledig seizoen', id='volledig-seizoen', msgctxt=30101),
dict(name='Volledige reeks', id='volledige-reeks', msgctxt=30102),
dict(name='Uit het archief', id='uit-het-archief', msgctxt=30103),
# Inhoudsgerelateerd
dict(name='Kortfilm', id='kortfilm', msgctxt=30120),
# Thema
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/favorites.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Favorites:

def __init__(self):
"""Initialize favorites, relies on XBMC vfs and a special VRT token"""
self._data = dict() # Our internal representation
self._data = {} # Our internal representation

@staticmethod
def is_activated():
Expand Down
6 changes: 3 additions & 3 deletions resources/lib/kodiutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def notify(sender, message, data):

def get_playerid():
"""Get current playerid"""
result = dict()
result = {}
while not result.get('result'):
result = jsonrpc(method='Player.GetActivePlayers')
return result.get('result', [{}])[0].get('playerid')
Expand Down Expand Up @@ -1094,7 +1094,7 @@ def open_url(url, data=None, headers=None, method=None, cookiejar=None, follow_r
opener = build_opener(*opener_args)

if not headers:
headers = dict()
headers = {}
req = Request(url, headers=headers)
if data is not None:
req.data = data
Expand All @@ -1111,7 +1111,7 @@ def open_url(url, data=None, headers=None, method=None, cookiejar=None, follow_r
req.get_method = lambda: method

if raise_errors is None:
raise_errors = list()
raise_errors = []
try:
return opener.open(req)
except HTTPError as exc:
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/resumepoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ResumePoints:

def __init__(self):
"""Initialize resumepoints, relies on XBMC vfs and a special VRT token"""
self._data = dict() # Our internal representation
self._data = {} # Our internal representation

@staticmethod
def is_activated():
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def search(self, keywords=None, page=0, edit=False):
label=colour(localize(30300)), # More…
path=url_for('search_query', keywords=keywords, page=page + 1),
art_dict=dict(thumb='DefaultAddonSearch.png'),
info_dict=dict(),
info_dict={},
))

self._favorites.refresh(ttl=ttl('indirect'))
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/tvguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def get_epg_data(self):
"""Return EPG data"""
now = datetime.now(dateutil.tz.tzlocal())

epg_data = dict()
epg_data = {}
for date in ['yesterday', 'today', 'tomorrow']:
epg = self.parse(date, now)
epg_url = epg.strftime(self.VRT_TVGUIDE)
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def play_url_to_id(url):
"""Convert a plugin:// url (e.g. plugin://plugin.video.vrt.nu/play/id/vid-5b12c0f6-b8fe-426f-a600-557f501f3be9/pbs-pub-7e2764cf-a8c0-4e78-9cbc-46d39381c237)
to an id dictionary (e.g. {'video_id': 'vid-5b12c0f6-b8fe-426f-a600-557f501f3be9'}
"""
play_id = dict()
play_id = {}
if 'play/id/' in url:
play_id['video_id'] = url.split('play/id/')[1].split('/')[0]
elif 'play/upnext/' in url:
Expand Down
4 changes: 2 additions & 2 deletions resources/lib/vrtplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def show_recent_menu(self, page=0, use_favorites=False):
label=colour(localize(30300)),
path=url_for(recent, page=page + 1),
art_dict=dict(thumb='DefaultRecentlyAddedEpisodes.png'),
info_dict=dict(),
info_dict={},
))

show_listing(episode_items, category=30020, sort=sort, ascending=ascending, content=content, cache=False)
Expand All @@ -317,7 +317,7 @@ def show_offline_menu(self, page=0, use_favorites=False):
label=localize(30300),
path=url_for(offline, page=page + 1),
art_dict=dict(thumb='DefaultYear.png'),
info_dict=dict(),
info_dict={},
))

show_listing(episode_items, category=30022, sort=sort, ascending=ascending, content=content, cache=False)
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/webscraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_video_attributes(vrtnu_url):
cache_file = 'web_video_attrs_multi.json'
video_attrs_multi = get_cache(cache_file, ttl=ttl('indirect'))
if not video_attrs_multi:
video_attrs_multi = dict()
video_attrs_multi = {}
if vrtnu_url in video_attrs_multi:
return video_attrs_multi[vrtnu_url]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_apihelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_get_api_data_multiple_seasons(self):
def test_get_api_data_specific_season(self):
"""Test listing episodes for a specific season (pano)"""
title_items, sort, ascending, content = self._apihelper.list_episodes(program='pano')
self.assertEqual(len(title_items), 7)
self.assertEqual(len(title_items), 8)
self.assertEqual(sort, 'label')
self.assertFalse(ascending)
self.assertEqual(content, 'files')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_vrtplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def test_featured(self):
self.assertTrue(feature.label in [item.get('name') for item in FEATURED], msg='%s is missing' % feature.label)
for feature in FEATURED:
self.assertTrue(feature.get('name') in [item.label for item in featured_items], msg='%s doesn\'t exist online' % feature.get('name'))
self.assertEqual(len(featured_items), 7)
self.assertEqual(len(featured_items), 8)

def test_play_unknown_program(self):
"""Test playing latest episode of an unknown program"""
Expand Down
14 changes: 7 additions & 7 deletions tests/xbmcgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,19 +259,19 @@ def __init__(self, label='', label2='', path='', offscreen=False):
self.path = path
self.offscreen = offscreen

self.art = dict()
self.art = {}
self.content_lookup = None
self.context_menu = list()
self.info = dict()
self.context_menu = []
self.info = {}
self.info_type = None
self.is_folder = False
self.mimetype = None
self.properties = dict()
self.properties = {}
self.rating = None
self.stream_info = dict()
self.stream_info = {}
self.stream_type = None
self.subtitles = list()
self.unique_ids = list()
self.subtitles = []
self.unique_ids = []

def addContextMenuItems(self, items, replaceItems=False):
"""A stub implementation for the xbmcgui ListItem class addContextMenuItems() method"""
Expand Down

0 comments on commit a61ce6d

Please sign in to comment.