本文整理汇总了Python中tornado.queues.QueueFull方法的典型用法代码示例。如果您正苦于以下问题:Python queues.QueueFull方法的具体用法?Python queues.QueueFull怎么用?Python queues.QueueFull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.queues
的用法示例。
在下文中一共展示了queues.QueueFull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_float_maxsize
# 需要导入模块: from tornado import queues [as 别名]
# 或者: from tornado.queues import QueueFull [as 别名]
def test_float_maxsize(self):
# Non-int maxsize must round down: http://bugs.python.org/issue21723
q = queues.Queue(maxsize=1.3)
self.assertTrue(q.empty())
self.assertFalse(q.full())
q.put_nowait(0)
q.put_nowait(1)
self.assertFalse(q.empty())
self.assertTrue(q.full())
self.assertRaises(queues.QueueFull, q.put_nowait, 2)
self.assertEqual(0, q.get_nowait())
self.assertFalse(q.empty())
self.assertFalse(q.full())
yield q.put(2)
put = q.put(3)
self.assertFalse(put.done())
self.assertEqual(1, (yield q.get()))
yield put
self.assertTrue(q.full())
示例2: test_float_maxsize
# 需要导入模块: from tornado import queues [as 别名]
# 或者: from tornado.queues import QueueFull [as 别名]
def test_float_maxsize(self):
# If a float is passed for maxsize, a reasonable limit should
# be enforced, instead of being treated as unlimited.
# It happens to be rounded up.
# http://bugs.python.org/issue21723
q = queues.Queue(maxsize=1.3) # type: ignore
self.assertTrue(q.empty())
self.assertFalse(q.full())
q.put_nowait(0)
q.put_nowait(1)
self.assertFalse(q.empty())
self.assertTrue(q.full())
self.assertRaises(queues.QueueFull, q.put_nowait, 2)
self.assertEqual(0, q.get_nowait())
self.assertFalse(q.empty())
self.assertFalse(q.full())
yield q.put(2)
put = q.put(3)
self.assertFalse(put.done())
self.assertEqual(1, (yield q.get()))
yield put
self.assertTrue(q.full())
示例3: test_nonblocking_put_exception
# 需要导入模块: from tornado import queues [as 别名]
# 或者: from tornado.queues import QueueFull [as 别名]
def test_nonblocking_put_exception(self):
q = queues.Queue(1)
q.put(0)
self.assertRaises(queues.QueueFull, q.put_nowait, 1)
示例4: test_nonblocking_put_exception
# 需要导入模块: from tornado import queues [as 别名]
# 或者: from tornado.queues import QueueFull [as 别名]
def test_nonblocking_put_exception(self):
q = queues.Queue(1) # type: queues.Queue[int]
q.put(0)
self.assertRaises(queues.QueueFull, q.put_nowait, 1)