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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from win32com.client import gencache
  5. import util
  6. import unittest
  7. ZeroD = 0
  8. OneDEmpty = []
  9. OneD = [
  10.     1,
  11.     2,
  12.     3]
  13. TwoD = [
  14.     [
  15.         1,
  16.         2,
  17.         3],
  18.     [
  19.         1,
  20.         2,
  21.         3],
  22.     [
  23.         1,
  24.         2,
  25.         3]]
  26. TwoD1 = [
  27.     [
  28.         [
  29.             1,
  30.             2,
  31.             3,
  32.             5],
  33.         [
  34.             1,
  35.             2,
  36.             3],
  37.         [
  38.             1,
  39.             2,
  40.             3]],
  41.     [
  42.         [
  43.             1,
  44.             2,
  45.             3],
  46.         [
  47.             1,
  48.             2,
  49.             3],
  50.         [
  51.             1,
  52.             2,
  53.             3]]]
  54. OneD1 = [
  55.     [
  56.         [
  57.             1,
  58.             2,
  59.             3],
  60.         [
  61.             1,
  62.             2,
  63.             3],
  64.         [
  65.             1,
  66.             2,
  67.             3]],
  68.     [
  69.         [
  70.             1,
  71.             2,
  72.             3],
  73.         [
  74.             1,
  75.             2,
  76.             3]]]
  77. OneD2 = [
  78.     [
  79.         1,
  80.         2,
  81.         3],
  82.     [
  83.         1,
  84.         2,
  85.         3,
  86.         4,
  87.         5],
  88.     [
  89.         [
  90.             1,
  91.             2,
  92.             3,
  93.             4,
  94.             5],
  95.         [
  96.             1,
  97.             2,
  98.             3,
  99.             4,
  100.             5],
  101.         [
  102.             1,
  103.             2,
  104.             3,
  105.             4,
  106.             5]]]
  107. ThreeD = [
  108.     [
  109.         [
  110.             1,
  111.             2,
  112.             3],
  113.         [
  114.             1,
  115.             2,
  116.             3],
  117.         [
  118.             1,
  119.             2,
  120.             3]],
  121.     [
  122.         [
  123.             1,
  124.             2,
  125.             3],
  126.         [
  127.             1,
  128.             2,
  129.             3],
  130.         [
  131.             1,
  132.             2,
  133.             3]]]
  134. FourD = [
  135.     [
  136.         [
  137.             [
  138.                 1,
  139.                 2,
  140.                 3],
  141.             [
  142.                 1,
  143.                 2,
  144.                 3],
  145.             [
  146.                 1,
  147.                 2,
  148.                 3]],
  149.         [
  150.             [
  151.                 1,
  152.                 2,
  153.                 3],
  154.             [
  155.                 1,
  156.                 2,
  157.                 3],
  158.             [
  159.                 1,
  160.                 2,
  161.                 3]],
  162.         [
  163.             [
  164.                 1,
  165.                 2,
  166.                 3],
  167.             [
  168.                 1,
  169.                 2,
  170.                 3],
  171.             [
  172.                 1,
  173.                 2,
  174.                 3]]],
  175.     [
  176.         [
  177.             [
  178.                 1,
  179.                 2,
  180.                 3],
  181.             [
  182.                 1,
  183.                 2,
  184.                 3],
  185.             [
  186.                 1,
  187.                 2,
  188.                 3]],
  189.         [
  190.             [
  191.                 1,
  192.                 2,
  193.                 3],
  194.             [
  195.                 1,
  196.                 2,
  197.                 3],
  198.             [
  199.                 1,
  200.                 2,
  201.                 3]],
  202.         [
  203.             [
  204.                 1,
  205.                 2,
  206.                 3],
  207.             [
  208.                 1,
  209.                 2,
  210.                 3],
  211.             [
  212.                 1,
  213.                 2,
  214.                 3]]]]
  215. LargeD = [
  216.     [
  217.         [
  218.             range(10)] * 10]] * 512
  219.  
  220. def _normalize_array(a):
  221.     if type(a) != type(()):
  222.         return a
  223.     ret = []
  224.     for i in a:
  225.         ret.append(_normalize_array(i))
  226.     
  227.     return ret
  228.  
  229.  
  230. class ArrayTest(util.TestCase):
  231.     
  232.     def setUp(self):
  233.         self.arr = gencache.EnsureDispatch('PyCOMTest.ArrayTest')
  234.  
  235.     
  236.     def tearDown(self):
  237.         self.arr = None
  238.  
  239.     
  240.     def _doTest(self, array):
  241.         self.arr.Array = array
  242.         self.failUnlessEqual(_normalize_array(self.arr.Array), array)
  243.  
  244.     
  245.     def testZeroD(self):
  246.         self._doTest(ZeroD)
  247.  
  248.     
  249.     def testOneDEmpty(self):
  250.         self._doTest(OneDEmpty)
  251.  
  252.     
  253.     def testOneD(self):
  254.         self._doTest(OneD)
  255.  
  256.     
  257.     def testTwoD(self):
  258.         self._doTest(TwoD)
  259.  
  260.     
  261.     def testThreeD(self):
  262.         self._doTest(ThreeD)
  263.  
  264.     
  265.     def testFourD(self):
  266.         self._doTest(FourD)
  267.  
  268.     
  269.     def testTwoD1(self):
  270.         self._doTest(TwoD1)
  271.  
  272.     
  273.     def testOneD1(self):
  274.         self._doTest(OneD1)
  275.  
  276.     
  277.     def testOneD2(self):
  278.         self._doTest(OneD2)
  279.  
  280.     
  281.     def testLargeD(self):
  282.         self._doTest(LargeD)
  283.  
  284.  
  285. if __name__ == '__main__':
  286.     
  287.     try:
  288.         util.testmain()
  289.     except SystemExit:
  290.         rc = None
  291.         if not rc:
  292.             raise 
  293.         rc
  294.     except:
  295.         None<EXCEPTION MATCH>SystemExit
  296.     
  297.  
  298. None<EXCEPTION MATCH>SystemExit
  299.