예제 #1
0
    def test_array_setting(self):
        arr = arrays.Array(4)

        arr[0] = 1
        arr[1] = 2
        arr[2] = 3
        arr[3] = 4

        self.assertEqual(arr[0], 1)
        self.assertEqual(arr[1], 2)
        self.assertEqual(arr[2], 3)
        self.assertEqual(arr[3], 4)
예제 #2
0
 def test_array_getting(self):
     arr = arrays.Array(data=[1, 2, 3, 4])
     self.assertEqual(arr[0], 1)
     self.assertEqual(arr[1], 2)
     self.assertEqual(arr[2], 3)
     self.assertEqual(arr[3], 4)
예제 #3
0
 def test_array_creation(self):
     self.assertTrue(arrays.Array(10))
예제 #4
0
 def test_failure_on_negative_sized_array(self):
     try:
         arrays.Array(-10)
     except ValueError:
         self.assertTrue(True)
예제 #5
0
 def test_failure_on_zero_array(self):
     try:
         arrays.Array(0)
     except ValueError:
         self.assertTrue(True)
예제 #6
0
 def test_failure_on_null_array(self):
     try:
         arrays.Array(data=[])
     except ValueError:
         self.assertTrue(True)