Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

testArrays.py 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Originally contributed by Stefan Schukat as part of this arbitrary-sized
  2. # arrays patch.
  3. from win32com.client import gencache
  4. from win32com.test import util
  5. ZeroD = 0
  6. OneDEmpty = []
  7. OneD = [1, 2, 3]
  8. TwoD = [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
  9. TwoD1 = [[[1, 2, 3, 5], [1, 2, 3], [1, 2, 3]], [[1, 2, 3], [1, 2, 3], [1, 2, 3]]]
  10. OneD1 = [[[1, 2, 3], [1, 2, 3], [1, 2, 3]], [[1, 2, 3], [1, 2, 3]]]
  11. OneD2 = [
  12. [1, 2, 3],
  13. [1, 2, 3, 4, 5],
  14. [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]],
  15. ]
  16. ThreeD = [[[1, 2, 3], [1, 2, 3], [1, 2, 3]], [[1, 2, 3], [1, 2, 3], [1, 2, 3]]]
  17. FourD = [
  18. [
  19. [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
  20. [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
  21. [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
  22. ],
  23. [
  24. [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
  25. [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
  26. [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
  27. ],
  28. ]
  29. LargeD = [
  30. [[list(range(10))] * 10],
  31. ] * 512
  32. def _normalize_array(a):
  33. if type(a) != type(()):
  34. return a
  35. ret = []
  36. for i in a:
  37. ret.append(_normalize_array(i))
  38. return ret
  39. class ArrayTest(util.TestCase):
  40. def setUp(self):
  41. self.arr = gencache.EnsureDispatch("PyCOMTest.ArrayTest")
  42. def tearDown(self):
  43. self.arr = None
  44. def _doTest(self, array):
  45. self.arr.Array = array
  46. self.assertEqual(_normalize_array(self.arr.Array), array)
  47. def testZeroD(self):
  48. self._doTest(ZeroD)
  49. def testOneDEmpty(self):
  50. self._doTest(OneDEmpty)
  51. def testOneD(self):
  52. self._doTest(OneD)
  53. def testTwoD(self):
  54. self._doTest(TwoD)
  55. def testThreeD(self):
  56. self._doTest(ThreeD)
  57. def testFourD(self):
  58. self._doTest(FourD)
  59. def testTwoD1(self):
  60. self._doTest(TwoD1)
  61. def testOneD1(self):
  62. self._doTest(OneD1)
  63. def testOneD2(self):
  64. self._doTest(OneD2)
  65. def testLargeD(self):
  66. self._doTest(LargeD)
  67. if __name__ == "__main__":
  68. try:
  69. util.testmain()
  70. except SystemExit as rc:
  71. if not rc:
  72. raise