def test_response_timeout(self): """ Test response with a timeout """ # New result r = AsyncResponse() # Get the value, with 1 second timeout. this should always fail r.response(1)
def test_create_and_resolve(self): """ The most basic test for getting and setting results """ # Create a new result r = AsyncResponse() # Should not be ready self.assertFalse(r.completed) # set the result r.resolve(TEST_RESPONSE) # Is the result ready self.assertTrue(r.completed) # test getting the result self.assertEqual(r.response(), TEST_RESPONSE)