mirror of
https://github.com/lutris/lutris
synced 2024-09-15 22:09:55 +00:00
some code cleanup
Signed-off-by: Antoine Mazeas <antoine@karthanis.net>
This commit is contained in:
parent
8ffcdf10af
commit
133c8ab29d
|
@ -26,8 +26,8 @@ def _try_import_moddb_library():
|
|||
class ModDB:
|
||||
def __init__(
|
||||
self,
|
||||
parse_page_method: types.MethodType = None,
|
||||
moddb_lib: types.ModuleType = _try_import_moddb_library()):
|
||||
moddb_lib: types.ModuleType = _try_import_moddb_library(),
|
||||
parse_page_method: types.MethodType = None):
|
||||
if moddb_lib is None:
|
||||
logger.warning(
|
||||
'The moddb library is not available, though the installer'
|
||||
|
|
|
@ -7,7 +7,7 @@ class ModDBHelperTests(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.mirrors_list = []
|
||||
self.page_type = self.ModDBFileObj
|
||||
self.helper_obj = ModDB(self.parse)
|
||||
self.helper_obj = ModDB(parse_page_method=self.parse)
|
||||
|
||||
def with_mirror(self, url: str, capacity: float):
|
||||
self.mirrors_list.append(moddb.boxes.Mirror(url=url, capacity=capacity))
|
||||
|
@ -17,17 +17,17 @@ class ModDBHelperTests(unittest.TestCase):
|
|||
self.page_type = page_type
|
||||
|
||||
def parse(self, url):
|
||||
return self.page_type(self.page_type, self.mirrors_list)
|
||||
return self.page_type(self.mirrors_list)
|
||||
|
||||
class ModDBFileObj(moddb.pages.File):
|
||||
def __init__(self, page_type, mirrors_list):
|
||||
def __init__(self, mirrors_list):
|
||||
self.mirrors_list = mirrors_list
|
||||
|
||||
def get_mirrors(self):
|
||||
return self.mirrors_list
|
||||
|
||||
class ModDBSomeOtherObj:
|
||||
def __init__(self, page_type, mirrors_list):
|
||||
def __init__(self, mirrors_list):
|
||||
pass
|
||||
|
||||
# ctor
|
||||
|
@ -38,7 +38,7 @@ class ModDBHelperTests(unittest.TestCase):
|
|||
def test_ctor_custom_method(self):
|
||||
def custom():
|
||||
pass
|
||||
hlpr = ModDB(custom)
|
||||
hlpr = ModDB(parse_page_method=custom)
|
||||
self.assertEqual(hlpr.parse, custom)
|
||||
|
||||
# missing moddb lib handling
|
||||
|
|
Loading…
Reference in a new issue