def testQueryNotificationsLongPoll(self):
    """Create a notification while a long-polling request is pending."""
    # First, get the current start_key.
    response_dict = self._tester.QueryNotifications(self._cookie)
    start_key = response_dict['last_key']

    # Start the long-polling request.
    with self._AccelerateTime():
      start_time = self.io_loop.time()
      self._tester.SendRequestAsync('query_notifications', self._cookie,
                                    {'max_long_poll': 60, 'start_key': start_key},
                                    callback=self.stop)

      # Wake up after 10 seconds.
      self.io_loop.add_timeout(self.io_loop.time() + 10, lambda: self.stop('timeout'))
      response = self.wait(timeout=12)
      self.assertEqual(response, 'timeout')

    # With time at normal speed (so we don't get internal timeouts), create a share activity.
    self._tester.ShareNew(self._cookie,
                          [(self._episode_id, self._photo_ids)],
                          [self._user2.user_id])

    # Now go back to waiting for the long poll.
    with self._AccelerateTime():
      response_dict = self.wait(timeout=75)
      end_time = self.io_loop.time()
    # It completed in much less time than max_long_poll.
    self.assertLess(start_time - end_time, 30)
    self.assertEqual(len(response_dict['notifications']), 1)
dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/test/query_notifications_test.py/QueryNotificationsTestCase.testQueryNotificationsLongPoll/swapped operands of `-`