From 6cf7f93f1febde57f7e165facbfdc2aa6b64275f Mon Sep 17 00:00:00 2001 From: Kaliko Jack Date: Tue, 4 Apr 2023 20:07:17 +0200 Subject: [PATCH] Fixed send_noidle (introduced with e8daa719) --- CHANGES.txt | 1 + musicpd.py | 2 +- test.py | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 61ba1ae..fc44e05 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,7 @@ Changes in 0.9.0 * Use right SPDX identifier for license headers * mpd_version attribute init to empty string instead of None + * Fixed send_noidle (introduced with e8daa719) Changes in 0.8.0 ---------------- diff --git a/musicpd.py b/musicpd.py index 4c57b9d..25abfd9 100644 --- a/musicpd.py +++ b/musicpd.py @@ -329,7 +329,7 @@ class MPDClient: def __getattr__(self, attr): if attr == 'send_noidle': # have send_noidle to cancel idle as well as noidle - return self.noidle() + return self.noidle if attr.startswith("send_"): command = attr.replace("send_", "", 1) wrapper = self._send diff --git a/test.py b/test.py index 6265af2..d90bd40 100755 --- a/test.py +++ b/test.py @@ -419,6 +419,12 @@ class TestMPDClient(unittest.TestCase): self.client.send_status() self.assertRaises(musicpd.CommandError, self.client.noidle) + def test_send_noidle_calls_noidle(self): + self.MPDWillReturn('OK\n') # nothing changed after idle + self.client.send_idle() + self.client.send_noidle() + self.assertMPDReceived('noidle\n') + def test_client_to_client(self): self.MPDWillReturn('OK\n') self.assertIsNone(self.client.subscribe("monty")) -- 2.39.5