Exemple #1
0
class HotStackTestCase(unittest.TestCase):
    
    def setUp(self):
        """Create the queue instance before the test."""
        self.stack = HotStack('testqueue')
    
    def tearDown(self):
        """Clear the queue after the test."""
        self.stack.clear()
    
    def test_consume(self):
        """Make sure we're accessing the elements in LIFO/FILO order"""
        nums = [1, 2, 3, 4, 5]
        self.stack.put(*nums)
        msgs = []
        for msg in self.stack.consume(timeout=1):
            msgs.append(msg)
        nums.reverse()
        self.assertEquals(msgs, nums)
Exemple #2
0
 def setUp(self):
     """Create the queue instance before the test."""
     self.stack = HotStack('testqueue')