File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ import unittest
4
+ try :
5
+ import queue
6
+ except ImportError : # python 2.x compatibility
7
+ import Queue as queue
8
+ from creational .pool import QueueObject
9
+
10
+
11
+ class TestPool (unittest .TestCase ):
12
+
13
+ def setUp (self ):
14
+
15
+ def test_object (queue ):
16
+ queue_object = QueueObject (queue , True )
17
+ print ('Inside func: {}' .format (queue_object .object ))
18
+
19
+ def test_pool_behavior (self ):
20
+ sample_queue = queue .Queue ()
21
+ sample_queue .put ('yam' )
22
+ self .assertTrue (sample_queue .get () == 'yam' )
23
+ # with QueueObject(sample_queue) as obj:
24
+ # print('Inside with: {}'.format(obj))
25
+
26
+ # sample_queue.put('sam')
27
+ # test_object(sample_queue)
28
+ # print('Outside func: {}'.format(sample_queue.get()))
29
+
30
+ # if not sample_queue.empty():
31
+ # print(sample_queue.get())
32
+
33
+
34
+ # if __name__ == '__main__':
35
+ # main()
36
+
37
+ ### OUTPUT ###
38
+ # Inside with: yam
39
+ # Outside with: yam
40
+ # Inside func: sam
41
+ # Outside func: sam
42
+
You can’t perform that action at this time.
0 commit comments