예제 #1
0
    def test_empty_to_bool(self):
        arr = Array.from_size(1)
        self.assertIsInstance(arr._strategy, _EmptyStrategy)

        arr.set_indexable_field(0, trueObject)
        self.assertIsInstance(arr._strategy, _BoolStrategy)
        self.assertEqual(trueObject, arr.get_indexable_field(0))
예제 #2
0
    def test_empty_to_obj(self):
        arr = Array.from_size(1)
        self.assertIsInstance(arr._strategy, _EmptyStrategy)

        arr.set_indexable_field(0, arr)
        self.assertIsInstance(arr._strategy, _ObjectStrategy)
        self.assertIs(arr, arr.get_indexable_field(0))
예제 #3
0
    def test_empty_to_bool(self):
        arr = Array.from_size(1)
        self.assertIsInstance(arr._strategy, _EmptyStrategy)

        arr.set_indexable_field(0, trueObject)
        self.assertIsInstance(arr._strategy, _BoolStrategy)
        self.assertEqual(trueObject, arr.get_indexable_field(0))
예제 #4
0
    def test_empty_to_obj(self):
        arr = Array.from_size(1)
        self.assertIsInstance(arr._strategy, _EmptyStrategy)

        arr.set_indexable_field(0, arr)
        self.assertIsInstance(arr._strategy, _ObjectStrategy)
        self.assertIs(arr, arr.get_indexable_field(0))
예제 #5
0
    def test_empty_to_int(self):
        arr = Array.from_size(1)
        self.assertIsInstance(arr._strategy, _EmptyStrategy)

        int_obj = Integer(42)

        arr.set_indexable_field(0, int_obj)
        self.assertIsInstance(arr._strategy, _LongStrategy)
        self.assertEqual(42, arr.get_indexable_field(0).get_embedded_integer())
예제 #6
0
    def test_empty_to_int(self):
        arr = Array.from_size(1)
        self.assertIsInstance(arr._strategy, _EmptyStrategy)

        int_obj = Integer(42)

        arr.set_indexable_field(0, int_obj)
        self.assertIsInstance(arr._strategy, _LongStrategy)
        self.assertEqual(42, arr.get_indexable_field(0).get_embedded_integer())
예제 #7
0
    def test_copy_and_extend_partially_empty(self):
        arr = Array.from_size(3)

        int_obj = Integer(42)
        arr.set_indexable_field(0, int_obj)
        self.assertIsInstance(arr._strategy, _PartiallyEmptyStrategy)
        new_arr = arr.copy_and_extend_with(int_obj)

        self.assertIsNot(arr, new_arr)
        self.assertEqual(4, new_arr.get_number_of_indexable_fields())
        self.assertIsInstance(new_arr._strategy, _PartiallyEmptyStrategy)
예제 #8
0
    def test_copy_and_extend_partially_empty(self):
        arr = Array.from_size(3)

        int_obj = Integer(42)
        arr.set_indexable_field(0, int_obj)
        self.assertIsInstance(arr._strategy, _PartiallyEmptyStrategy)
        new_arr = arr.copy_and_extend_with(int_obj)

        self.assertIsNot(arr, new_arr)
        self.assertEqual(4, new_arr.get_number_of_indexable_fields())
        self.assertIsInstance(new_arr._strategy, _PartiallyEmptyStrategy)
예제 #9
0
 def test_empty_array(self):
     arr = Array.from_size(0)
     self.assertIsInstance(arr._strategy, _EmptyStrategy)
예제 #10
0
 def new_array_with_length(self, length):
     return Array.from_size(length)
예제 #11
0
 def new_array_with_length(self, length):
     return Array.from_size(length)
예제 #12
0
 def test_empty_array(self):
     arr = Array.from_size(0)
     self.assertIsInstance(arr._strategy, _EmptyStrategy)