Repository: pyccel/pyccel
Pull request #1982 (2024-09-06 11:41:37)

Add  support for list.append method 
Add support for list.append method

pyccel-bot[bot]: Hello again! Thank you for this new pull request :star_struck:.

Please begin by requesting your checklist using the command `/bot checklist`

jalalium: /bot checklist
jalalium: /bot run pr_tests
pyccel-bot[bot]: Hey @pyccel/pyccel-dev ! @jalalium has just created this great new pull request! Check it out and let me know what you think!

pyccel-bot[bot]: @jalalium, @EmilyBourne has a few questions/comments about your code. Can you go through and see if you agree with them. If not go ahead and explain why. Once you've adressed all the comments let me know with `/bot mark as ready` and we will see if we can get approval.

pyccel-bot[bot]: @jalalium, @EmilyBourne has a few questions/comments about your code. Can you go through and see if you agree with them. If not go ahead and explain why. Once you've adressed all the comments let me know with `/bot mark as ready` and we will see if we can get approval.


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9f51ca31..0823179a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file.
 -   #1874 : Add C and Fortran support for the `len()` function for the `list` container.
 -   #1875 : Add C and Fortran support for the `len()` function for the `set` container.
 -   #1908 : Add C and Fortran support for the `len()` function for the `dict` container.
+-   #1689 : Add C and Fortran support for list method `append()`.
 -   #1876 : Add C support for indexing lists.
 -   #1690 : Add C support for list method `pop()`.
 -   #1877 : Add C Support for set method `pop()`.
diff --git a/docs/builtin-functions.md b/docs/builtin-functions.md
index 726ff39a..d15f0e6d 100644
--- a/docs/builtin-functions.md
+++ b/docs/builtin-functions.md
@@ -78,7 +78,7 @@ Python contains a limited number of builtin functions defined [here](https://doc
 
 | Method | Supported |
 |----------|-----------|
-| `append` | Python-only |
+| **`append`** | **Yes** |
 | `clear` | Python-only |
 | `copy` | Python-only |
 | `count` | No |
diff --git a/pyccel/codegen/printing/ccode.py b/pyccel/codegen/printing/ccode.py
index c9f33417..e11e9d8e 100644
--- a/pyccel/codegen/printing/ccode.py
+++ b/pyccel/codegen/printing/ccode.py
@@ -2580,6 +2580,14 @@ class CCodePrinter(CodePrinter):
         return methods + interfaces
 
     #================== List methods ==================
+    def _print_ListAppend(self, expr):
+        target = expr.list_obj
+        class_type = target.class_type
+        c_type = self.get_c_type(class_type)
+        arg = self._print(expr.args[0])
+        list_obj = self._print(ObjectAddress(expr.list_obj))
+        return f'{c_type}_push({list_obj}, {arg});\n'
+
     def _print_ListPop(self, expr):
         class_type = expr.list_obj.class_type
         c_type = self.get_c_type(class_type)
diff --git a/pyccel/codegen/printing/fcode.py b/pyccel/codegen/printing/fcode.py
index 039a49e9..4e8ad525 100644
--- a/pyccel/codegen/printing/fcode.py
+++ b/pyccel/codegen/printing/fcode.py
@@ -1147,6 +1147,14 @@ class FCodePrinter(CodePrinter):
         value = self._print(expr.internal_var)
         return f'aimag({value})'
 
+    #========================== List Methods ===============================#
+
+    def _print_ListAppend(self, expr):
+        target = expr.list_obj
+        arg = self._print(expr.args[0])
+        return f'call {target} % push_back({arg})\n'
+
+
 
 
     #========================== Numpy Elements ===============================#


Test patch:
diff --git a/tests/epyccel/test_epyccel_lists.py b/tests/epyccel/test_epyccel_lists.py
index 024d53ad..8a25b46d 100644
--- a/tests/epyccel/test_epyccel_lists.py
+++ b/tests/epyccel/test_epyccel_lists.py
@@ -14,7 +14,7 @@ from pyccel import epyccel
     ],
     scope = "module"
 )
-def language(request):
+def limited_language(request):
     return request.param
 
 def test_pop_last_element(stc_language) :
@@ -47,27 +47,27 @@ def test_pop_list_float(stc_language) :
     assert isinstance(python_result, type(pyccel_result))
     assert python_result == pyccel_result
 
-def test_pop_list_of_lists(language) :
+def test_pop_list_of_lists(limited_language) :
     def pop_last_element():
         a = [[4.6, 3.3], [4.2, 9.1], [2.3, 6.8]]
         return a.pop()
-    epyc_last_element = epyccel(pop_last_element, language = language)
+    epyc_last_element = epyccel(pop_last_element, language = limited_language)
     pyccel_result = epyc_last_element()
     python_result = pop_last_element()
     assert isinstance(python_result, type(pyccel_result))
     assert python_result == pyccel_result
 
-def test_pop_list_of_tuples(language) :
+def test_pop_list_of_tuples(limited_language) :
     def pop_last_element():
         a = [(4.6, 3.3), (4.2, 9.1), (2.3, 6.8)]
         return a.pop()
-    epyc_last_element = epyccel(pop_last_element, language = language)
+    epyc_last_element = epyccel(pop_last_element, language = limited_language)
     pyccel_result = epyc_last_element()
     python_result = pop_last_element()
     assert isinstance(python_result, type(pyccel_result))
     assert python_result == pyccel_result
 
-def test_pop_list_of_ndarrays(language) :
+def test_pop_list_of_ndarrays(limited_language) :
     def pop_last_element():
         from numpy import array
 
@@ -76,7 +76,7 @@ def test_pop_list_of_ndarrays(language) :
         array3 = array([[13, 14, 15], [16, 17, 18]])
         a = [array1, array2, array3]
         return a.pop()
-    epyc_last_element = epyccel(pop_last_element, language = language)
+    epyc_last_element = epyccel(pop_last_element, language = limited_language)
     pyccel_result = epyc_last_element()
     python_result = pop_last_element()
     assert isinstance(python_result, type(pyccel_result))
@@ -117,7 +117,7 @@ def test_append_basic(language):
     def f():
         a = [1, 2, 3]
         a.append(4)
-        return a
+        return len(a), a[0], a[1], a[2], a[3]
 
     epyc_f = epyccel(f, language=language)
     assert f() == epyc_f()
@@ -128,18 +128,18 @@ def test_append_multiple(language):
         a.append(4)
         a.append(5)
         a.append(6)
-        return a
+        return len(a), a[0], a[1], a[2], a[3], a[4], a[5]
 
     epyc_f = epyccel(f, language=language)
     assert f() == epyc_f()
 
-def test_append_list(language):
+def test_append_list(limited_language):
     def f():
         a = [[1, 2, 3]]
         a.append([4, 5, 6])
-        return a
+        return len(a)
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
 def test_append_range(language):
@@ -148,19 +148,19 @@ def test_append_range(language):
         for i in range(0, 1000):
             a.append(i)
         a.append(1000)
-        return a
+        return len(a), a[-1], a[-2]
 
     epyc_f = epyccel(f, language=language)
     assert f() == epyc_f()
 
-def test_append_range_list(language):
+def test_append_range_list(limited_language):
     def f():
         a = [[1, 2, 3]]
         for i in range(0, 1000):
             a.append([i, i + 1])
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
 def test_append_bool(language):
@@ -169,7 +169,7 @@ def test_append_bool(language):
         a.append(False)
         a.append(False)
         a.append(True)
-        return a
+        return len(a), a[3], a[4], a[5]
 
     epyc_f = epyccel(f, language=language)
     assert f() == epyc_f()
@@ -180,7 +180,7 @@ def test_append_float(language):
         a.append(3.0)
         a.append(2.9)
         a.append(1.1)
-        return a
+        return len(a), a[3], a[4], a[5]
 
     epyc_f = epyccel(f, language=language)
     assert f() == epyc_f()
@@ -191,12 +191,12 @@ def test_append_complex(language):
         a.append(9j)
         a.append(2 + 2j)
         a.append(1j)
-        return a
+        return len(a), a[3], a[4], a[5]
 
     epyc_f = epyccel(f, language=language)
     assert f() == epyc_f()
 
-def test_append_ndarrays(language):
+def test_append_ndarrays(limited_language):
     def f():
         from numpy import array
 
@@ -212,29 +212,29 @@ def test_append_ndarrays(language):
         a.append(array6)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert np.array_equal(f(), epyc_f())
 
-def test_append_user_defined_objects(language):
+def test_append_user_defined_objects(limited_language):
     import modules.list_user_defined_objs2 as mod
 
-    modnew = epyccel(mod, language=language)
+    modnew = epyccel(mod, language=limited_language)
     python_list = mod.fn()
     accelerated_list = modnew.fn()
     assert len(python_list) == len(accelerated_list)
     for python_elem, accelerated_elem in zip(python_list, accelerated_list):
         assert python_elem.x == accelerated_elem.x
 
-def test_insert_basic(language):
+def test_insert_basic(limited_language):
     def f():
         a = [1, 2, 3]
         a.insert(4, 4)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_insert_booleans(language):
+def test_insert_booleans(limited_language):
     def f():
         a = [True, False, True]
         a.insert(0, True)
@@ -246,10 +246,10 @@ def test_insert_booleans(language):
         a.insert(-25, False)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_insert_complex(language):
+def test_insert_complex(limited_language):
     def f():
         a = [2j, 3 + 6j, 0 + 0j]
         a.insert(0, 9j)
@@ -261,10 +261,10 @@ def test_insert_complex(language):
         a.insert(-25, 0 - 0j)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_insert_float(language):
+def test_insert_float(limited_language):
     def f():
         a = [0.0, 3.6 , 0.5]
         a.insert(0, 6.4)
@@ -276,10 +276,10 @@ def test_insert_float(language):
         a.insert(-25, 2.5)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_insert_ndarrays(language):
+def test_insert_ndarrays(limited_language):
     def f():
         from numpy import array
 
@@ -296,10 +296,10 @@ def test_insert_ndarrays(language):
         a.insert(-3, array6)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert np.array_equal(f(), epyc_f())
 
-def test_insert_multiple(language):
+def test_insert_multiple(limited_language):
     def f():
         a = [1, 2, 3]
         a.insert(4, 4)
@@ -307,95 +307,95 @@ def test_insert_multiple(language):
         a.insert(1, 6)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_insert_list(language):
+def test_insert_list(limited_language):
     def f():
         a = [[1, 2, 3]]
         a.insert(1, [4, 5, 6])
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_insert_range(language):
+def test_insert_range(limited_language):
     def f():
         a = [1, 2, 3]
         for i in range(4, 1000):
             a.insert(i - 1 ,i)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_insert_range_list(language):
+def test_insert_range_list(limited_language):
     def f():
         a = [[1, 2, 3]]
         for i in range(4, 1000):
             a.insert(i, [i, i + 1])
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_insert_user_defined_objects(language):
+def test_insert_user_defined_objects(limited_language):
     import modules.list_user_defined_objs as mod
 
-    modnew = epyccel(mod, language=language)
+    modnew = epyccel(mod, language=limited_language)
     python_list = mod.fn()
     accelerated_list = modnew.fn()
     assert len(python_list) == len(accelerated_list)
     for python_elem, accelerated_elem in zip(python_list, accelerated_list):
         assert python_elem.x == accelerated_elem.x
 
-def test_clear_1(language):
+def test_clear_1(limited_language):
 
     def clear_1():
         a = [1, 2, 3]
         a.clear()
         return a
 
-    epyc_clear_1 = epyccel(clear_1, language = language)
+    epyc_clear_1 = epyccel(clear_1, language = limited_language)
     pyccel_result = epyc_clear_1()
     python_result = clear_1()
     assert python_result == pyccel_result
 
-def test_clear_2(language):
+def test_clear_2(limited_language):
 
     def clear_2():
         a = []
         a.clear()
         return a
 
-    epyc_clear_2 = epyccel(clear_2, language = language)
+    epyc_clear_2 = epyccel(clear_2, language = limited_language)
     pyccel_result = epyc_clear_2()
     python_result = clear_2()
     assert python_result == pyccel_result
 
-def test_clear_3(language):
+def test_clear_3(limited_language):
 
     def clear_3():
         a = [[1, 2, 3]]
         a.clear()
         return a
 
-    epyc_clear_3 = epyccel(clear_3, language = language)
+    epyc_clear_3 = epyccel(clear_3, language = limited_language)
     pyccel_result = epyc_clear_3()
     python_result = clear_3()
     assert python_result == pyccel_result
 
-def test_extend_basic(language):
+def test_extend_basic(limited_language):
     def f():
         a = [1, 2, 3]
         b = [4, 5, 6]
         a.extend(b)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_multiple(language):
+def test_extend_multiple(limited_language):
     def f():
         a = [1, 2, 3]
         a.extend([4, 5])
@@ -403,68 +403,68 @@ def test_extend_multiple(language):
         a.extend([10])
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_nested_list(language):
+def test_extend_nested_list(limited_language):
     def f():
         a = [[1, 2, 3]]
         a.extend([[4, 5, 6]])
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_tuple_with_list(language):
+def test_extend_tuple_with_list(limited_language):
     def f():
         a = [1, 2, 3]
         b = (4, 5, 6)
         a.extend(b)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_boolean_tuple(language):
+def test_extend_boolean_tuple(limited_language):
     def f():
         a = [True, False, True]
         b = (False, True, False)
         a.extend(b)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_float_tuple(language):
+def test_extend_float_tuple(limited_language):
     def f():
         a = [3.4, 2.1, 3.9]
         b = (4.1, 5.9, 0.3)
         a.extend(b)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_complex_list(language):
+def test_extend_complex_list(limited_language):
     def f():
         a = [1j, 2 + 3j, 0 + 0j]
         b = [4j, 5j, 1 + 6j]
         a.extend(b)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_range(language):
+def test_extend_range(limited_language):
     def f():
         a = [1, 2, 3]
         a.extend(range(4, 9))
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_function_return(language):
+def test_extend_function_return(limited_language):
     def f():
         def g():
             a = [4, 5]
@@ -473,55 +473,55 @@ def test_extend_function_return(language):
         lst = [1, 2, 3]
         lst.extend(g())
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_sort_basic(language):
+def test_sort_basic(limited_language):
     def f():
         a = [4, 0, 1, -1]
         a.sort()
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_sort_bool(language):
+def test_sort_bool(limited_language):
     def f():
         a = [True, False, False, True, False]
         a.sort()
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_sort_float(language):
+def test_sort_float(limited_language):
     def f():
         a = [3.4, 1.0, -4.5, 0.0, 2.1]
         a.sort()
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_list_as_arg(language):
+def test_extend_list_as_arg(limited_language):
     def f():
         a = [1, 2, 3]
         a.extend([4, 5, 6])
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_tuple_as_arg(language):
+def test_extend_tuple_as_arg(limited_language):
     def f():
         a = [1, 2, 3]
         a.extend((4, 5, 6))
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_np_int(language):
+def test_extend_np_int(limited_language):
     def f():
         from numpy import ones, int64
 
@@ -530,10 +530,10 @@ def test_extend_np_int(language):
         a.extend(b)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_np_float(language):
+def test_extend_np_float(limited_language):
     def f():
         from numpy import ones, float64
 
@@ -542,78 +542,78 @@ def test_extend_np_float(language):
         a.extend(b)
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_user_defined_objects(language):
+def test_extend_user_defined_objects(limited_language):
     import modules.list_user_defined_objs2 as mod
 
-    modnew = epyccel(mod, language=language)
+    modnew = epyccel(mod, language=limited_language)
     python_list = mod.fn()
     accelerated_list = modnew.fn()
     assert len(python_list) == len(accelerated_list)
     for python_elem, accelerated_elem in zip(python_list, accelerated_list):
         assert python_elem.x == accelerated_elem.x
 
-def test_remove_basic(language):
+def test_remove_basic(limited_language):
     def f():
         lst = [1, 2, 3, 4]
         lst.remove(3)
         return lst
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_remove_float(language):
+def test_remove_float(limited_language):
     def f():
         lst = [1.4, 2.3, 3.2, 4.4]
         lst.remove(3.2)
         return lst
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_remove_complex(language):
+def test_remove_complex(limited_language):
     def f():
         lst = [1j, 3j, 8j]
         lst.remove(3j)
         return lst
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_remove_list_from_list(language):
+def test_remove_list_from_list(limited_language):
     def f():
         lst = [[True, False, True], [False, True]]
         lst.remove([False, True])
         return lst
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_extend_list_class_attribute(language):
+def test_extend_list_class_attribute(limited_language):
     import modules.list_class_attr as mod
 
-    modnew = epyccel(mod, language=language)
+    modnew = epyccel(mod, language=limited_language)
     python_list = mod.fn()
     accelerated_list = modnew.fn()
     assert python_list == accelerated_list
 
-def test_copy_basic(language):
+def test_copy_basic(limited_language):
     def f():
         a = [1, 2, 3]
         b = a.copy()
         return b
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_copy_nested(language):
+def test_copy_nested(limited_language):
     def f():
         a = [[1, 2], [3, 4]]
         b = a.copy()
         return b
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_copy_modify_nested_values(language):
+def test_copy_modify_nested_values(limited_language):
     def f():
         a = [[1, 2], [3, 4]]
         b = a.copy()
@@ -621,10 +621,10 @@ def test_copy_modify_nested_values(language):
         a[0][1] = 0
         return b
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
-def test_mixed_list_methods(language):
+def test_mixed_list_methods(limited_language):
     def f():
         a = [(1, 4, 5), (33, 12, 5), (3, 5)]
         a.append((0, 1, 2))
@@ -634,7 +634,7 @@ def test_mixed_list_methods(language):
         a.extend(((4, 5, 6), (3, 3)))
         return a
 
-    epyc_f = epyccel(f, language=language)
+    epyc_f = epyccel(f, language=limited_language)
     assert f() == epyc_f()
 
 @pytest.mark.parametrize( 'language', [
@@ -679,11 +679,11 @@ def test_mutable_multi_level_indexing(stc_language):
     epyc_f = epyccel(f, language=stc_language)
     assert f() == epyc_f()
 
-def test_homogenous_list_int_copy(language):
+def test_homogenous_list_int_copy(limited_language):
     def homogeneous_list_int():
         return list([1, 2, 3, 4])
     f1 = homogeneous_list_int
-    f2 = epyccel( f1 , language=language)
+    f2 = epyccel( f1 , language=limited_language)
 
     python_out = f1()
     pyccel_out = f2()
@@ -692,11 +692,11 @@ def test_homogenous_list_int_copy(language):
 
     assert python_out == pyccel_out
 
-def test_homogenous_list_bool_copy(language):
+def test_homogenous_list_bool_copy(limited_language):
     def homogeneous_list_bool():
         return list([True, False, True, False])
     f1 = homogeneous_list_bool
-    f2 = epyccel( f1 , language=language)
+    f2 = epyccel( f1 , language=limited_language)
 
     python_out = f1()
     pyccel_out = f2()
@@ -705,11 +705,11 @@ def test_homogenous_list_bool_copy(language):
 
     assert python_out == pyccel_out
 
-def test_homogenous_list_float_copy(language):
+def test_homogenous_list_float_copy(limited_language):
     def homogeneous_list_float():
         return list([1.0, 2.0, 3.0, 4.0])
     f1 = homogeneous_list_float
-    f2 = epyccel( f1 , language=language)
+    f2 = epyccel( f1 , language=limited_language)
 
     python_out = f1()
     pyccel_out = f2()
@@ -718,11 +718,11 @@ def test_homogenous_list_float_copy(language):
 
     assert python_out == pyccel_out
 
-def test_homogenous_list_int_tuple_copy(language):
+def test_homogenous_list_int_tuple_copy(limited_language):
     def homogeneous_list_int_tuple():
         return list((1, 2, 3, 4))
     f1 = homogeneous_list_int_tuple
-    f2 = epyccel( f1 , language=language)
+    f2 = epyccel( f1 , language=limited_language)
 
     python_out = f1()
     pyccel_out = f2()
@@ -731,13 +731,13 @@ def test_homogenous_list_int_tuple_copy(language):
 
     assert python_out == pyccel_out
 
-def test_homogenous_list_unknown_size_copy(language):
+def test_homogenous_list_unknown_size_copy(limited_language):
     def homogeneous_list_unknown_size_copy(n : int):
         a = (3,)*n
         b = list(a)
         return b[0]
     f1 = homogeneous_list_unknown_size_copy
-    f2 = epyccel( f1 , language=language)
+    f2 = epyccel( f1 , language=limited_language)
 
     python_out = f1(5)
     pyccel_out = f2(5)