Modernize code for easier Python 3 port

- Replace print statement with function call
- Replace except ..., ...: syntax with except ... as ...:
- Simplify obsolete try ... except ... code block
- Replace some unicode calls with u-prefixed strings
- Do not use `len(SEQUENCE)` to determine if a sequence is empty
- Replace dictionary creation
- Drop support for GObject static bindings
This commit is contained in:
JoeLametta
2019-01-16 21:08:43 +00:00
parent 0e17b32740
commit fef7973113
6 changed files with 17 additions and 28 deletions

View File

@@ -15,9 +15,8 @@ class PathTestCase(unittest.TestCase):
path = prog.getPath(u'/tmp', DEFAULT_DISC_TEMPLATE,
'mbdiscid', None)
self.assertEqual(path,
unicode('/tmp/unknown/Unknown Artist - mbdiscid/'
'Unknown Artist - mbdiscid'))
self.assertEqual(path, (u'/tmp/unknown/Unknown Artist - mbdiscid/'
u'Unknown Artist - mbdiscid'))
def testStandardTemplateFilled(self):
prog = program.Program(config.Config())
@@ -27,9 +26,8 @@ class PathTestCase(unittest.TestCase):
path = prog.getPath(u'/tmp', DEFAULT_DISC_TEMPLATE,
'mbdiscid', md, 0)
self.assertEqual(path,
unicode('/tmp/unknown/Jeff Buckley - Grace/'
'Jeff Buckley - Grace'))
self.assertEqual(path, (u'/tmp/unknown/Jeff Buckley - Grace/'
u'Jeff Buckley - Grace'))
def testIssue66TemplateFilled(self):
prog = program.Program(config.Config())