Back to index

python3.2  3.2.2
Public Member Functions
test.test_deque.TestSubclass Class Reference

List of all members.

Public Member Functions

def test_basics
def test_copy_pickle

Detailed Description

Definition at line 552 of file test_deque.py.


Member Function Documentation

Definition at line 554 of file test_deque.py.

00554 
00555     def test_basics(self):
00556         d = Deque(range(25))
00557         d.__init__(range(200))
00558         for i in range(200, 400):
00559             d.append(i)
00560         for i in reversed(range(-200, 0)):
00561             d.appendleft(i)
00562         self.assertEqual(list(d), list(range(-200, 400)))
00563         self.assertEqual(len(d), 600)
00564 
00565         left = [d.popleft() for i in range(250)]
00566         self.assertEqual(left, list(range(-200, 50)))
00567         self.assertEqual(list(d), list(range(50, 400)))
00568 
00569         right = [d.pop() for i in range(250)]
00570         right.reverse()
00571         self.assertEqual(right, list(range(150, 400)))
00572         self.assertEqual(list(d), list(range(50, 150)))
00573 
00574         d.clear()
00575         self.assertEqual(len(d), 0)

Here is the call graph for this function:

Definition at line 576 of file test_deque.py.

00576 
00577     def test_copy_pickle(self):
00578 
00579         d = Deque('abc')
00580 
00581         e = d.__copy__()
00582         self.assertEqual(type(d), type(e))
00583         self.assertEqual(list(d), list(e))
00584 
00585         e = Deque(d)
00586         self.assertEqual(type(d), type(e))
00587         self.assertEqual(list(d), list(e))
00588 
00589         s = pickle.dumps(d)
00590         e = pickle.loads(s)
00591         self.assertNotEqual(id(d), id(e))
00592         self.assertEqual(type(d), type(e))
00593         self.assertEqual(list(d), list(e))
00594 
00595         d = Deque('abcde', maxlen=4)
00596 
00597         e = d.__copy__()
00598         self.assertEqual(type(d), type(e))
00599         self.assertEqual(list(d), list(e))
00600 
00601         e = Deque(d)
00602         self.assertEqual(type(d), type(e))
00603         self.assertEqual(list(d), list(e))
00604 
00605         s = pickle.dumps(d)
00606         e = pickle.loads(s)
00607         self.assertNotEqual(id(d), id(e))
00608         self.assertEqual(type(d), type(e))
00609         self.assertEqual(list(d), list(e))

Here is the call graph for this function:


The documentation for this class was generated from the following file: