From c3485b5b0415fb4e4bdf64b1f0bf6cf0840c4567 Mon Sep 17 00:00:00 2001 From: "Graham R. Cobb" Date: Tue, 16 Mar 2021 22:36:42 +0000 Subject: [PATCH] Remove unnecessary call to format. Signed-off-by: Graham R. Cobb --- beetsplug/bareasc.py | 5 ++--- test/test_bareasc.py | 9 +++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/beetsplug/bareasc.py b/beetsplug/bareasc.py index 2bdad98fc..4d574c756 100644 --- a/beetsplug/bareasc.py +++ b/beetsplug/bareasc.py @@ -74,13 +74,12 @@ class BareascPlugin(BeetsPlugin): """Emulate normal 'list' command but with unidecode output.""" query = decargs(args) album = opts.album - fmt = u'' # Copied from commands.py - list_items if album: for album in lib.albums(query): - bare = unidecode(six.ensure_text(format(album, fmt))) + bare = unidecode(six.ensure_text(str(album))) print_(six.ensure_text(bare)) else: for item in lib.items(query): - bare = unidecode(six.ensure_text(format(item, fmt))) + bare = unidecode(six.ensure_text(str(item))) print_(six.ensure_text(bare)) diff --git a/test/test_bareasc.py b/test/test_bareasc.py index abb42a730..1ce4e6176 100644 --- a/test/test_bareasc.py +++ b/test/test_bareasc.py @@ -136,6 +136,15 @@ class BareascPluginTest(unittest.TestCase, TestHelper): self.assertIn('Antonin Dvorak', output.getvalue()) + def test_bareasc_format_output(self): + """Bare-ASCII version of list -f command - check output.""" + with capture_stdout() as output: + self.run_command('bareasc', 'with accents', + '-f', '$artist:: $title') + + self.assertEqual('Antonin Dvorak:: with accents\n', + output.getvalue()) + def suite(): """loader."""