home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_365 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  1.3 KB  |  41 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import unittest
  5. from ctypes import *
  6.  
  7. class MyTestCase(unittest.TestCase):
  8.     
  9.     def test_incomplete_example(self):
  10.         lpcell = POINTER('cell')
  11.         
  12.         class cell((Structure,)):
  13.             _fields_ = [
  14.                 ('name', c_char_p),
  15.                 ('next', lpcell)]
  16.  
  17.         SetPointerType(lpcell, cell)
  18.         c1 = cell()
  19.         c1.name = 'foo'
  20.         c2 = cell()
  21.         c2.name = 'bar'
  22.         c1.next = pointer(c2)
  23.         c2.next = pointer(c1)
  24.         p = c1
  25.         result = []
  26.         for i in range(8):
  27.             result.append(p.name)
  28.             p = p.next[0]
  29.         
  30.         self.failUnlessEqual(result, [
  31.             'foo',
  32.             'bar'] * 4)
  33.         _pointer_type_cache = _pointer_type_cache
  34.         import ctypes
  35.         del _pointer_type_cache[cell]
  36.  
  37.  
  38. if __name__ == '__main__':
  39.     unittest.main()
  40.  
  41.