Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)
Handle a new update.

Fetches new data from the client, then compares it to the previous
lookup.

Returns:
    (bool, new_data): whether changes occurred, and the new value.

src/m/p/mpdlcd-0.4.0/tests/test_mpdhooks.py   mpdlcd(Download)
    def test_status_hook(self):
        hook = mpdhooks.StatusHook()
 
        client = self.FakeClient(status={'bitrate': 42})
        changed, new = hook.handle(client)
        self.assertTrue(changed)
        self.assertEqual({'bitrate': 42}, new)
 
        client2 = self.FakeClient(status={'bitrate': 13})
        changed2, new2 = hook.handle(client2)
        # Another field changes
        client3 = self.FakeClient(state='play', status={'bitrate': 13})
        changed3, new3 = hook.handle(client3)
        self.assertFalse(changed3)
        self.assertIsNone(new3)