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_state_hook(self):
        hook = mpdhooks.StateHook()
 
        client = self.FakeClient(state='stop')
        changed, new = hook.handle(client)
        self.assertTrue(changed)
        self.assertEqual('stop', new)
 
        client2 = self.FakeClient(state='play')
        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)