def test_append_doubles_array_capacity_if_capacity_reached(self):
        da = DynamicArray()
        da._n = 2
        da._capacity = 2
        da._A = da._make_array(da._capacity)
        da._A[0:2] = ['foo', 'bar']
        expected_result = 4

        da.append('spam')
        result = da._capacity

        self.assertEqual(result, expected_result)
    def test_append_adds_object_at_end_of_array(self):
        da = DynamicArray()
        expected_result = 'foo'

        da.append(expected_result)

        self.assertEqual(da._A[-1], expected_result)
        self.assertEqual(da._n, 1)

        expected_result = 'bar'
        da.append(expected_result)

        self.assertEqual(da._A[-1], expected_result)
        self.assertEqual(da._n, 2)