Repository: pyccel/pyccel (python)

Issue:
Missing boolean cast in Fortran code
### Describe the bug
 Python scripts written to test the fix for the issue #1762 #1641, results in compilation error for the fortran language. Please let me know if there is any existing issue which tracks this behavior. 

### To Reproduce
Provide code to reproduce the behavior:
Example 1:
```python
@template('T1', ['bool[:,:]', 'int[:,:]', 'int8[:,:]', 'int16[:,:]', 'int32[:,:]', 'int64[:,:]', 'float[:,:]', 'float32[:,:]', 'float64[:,:]', 'complex64[:,:]', 'complex128[:,:]'])
def create_bool_copy(a : 'T1'):
    c = np.array(a, dtype='bool')
    return c

if __name__ == '__main__':
    arr = np.ones((2,2), dtype='int16')
    arr[1, 1] = 256
    arr[0, 1] = -1
    arr[1, 0] = 64
    arr[0, 0] = -1
    print(arr)
    arr2 = create_bool_copy(arr)
    print(arr2)
```
Example 2:
```python
def create_float_copy(a : 'bool[:,:]'):
    c = np.array(a, dtype='float32')
    return c

if __name__ == '__main__':
    arr = np.ones((2,2), dtype='bool')
    print(arr)
    arr2 = create_float_copy(arr)
    print(arr2)
```                                                                                              
### Error details
Provide the generated code, or the error message:
```
ERROR at Fortran compilation stage
Traceback (most recent call last):
  File "/home/varadarajan/softwares/my-jupyter-env/bin/pyccel", line 8, in <module>
    sys.exit(pyccel())
  File "/home/varadarajan/softwares/my-jupyter-env/lib/python3.10/site-packages/pyccel/commands/console.py", line 266, in pyccel
    execute_pyccel(filename,
  File "/home/varadarajan/softwares/my-jupyter-env/lib/python3.10/site-packages/pyccel/codegen/pipeline.py", line 378, in execute_pyccel
    src_compiler.compile_module(compile_obj=mod_obj,
  File "/home/varadarajan/softwares/my-jupyter-env/lib/python3.10/site-packages/pyccel/codegen/compiling/compilers.py", line 355, in compile_module
    self.run_command(cmd, verbose)
  File "/home/varadarajan/softwares/my-jupyter-env/lib/python3.10/site-packages/pyccel/codegen/compiling/compilers.py", line 500, in run_command
    raise RuntimeError(err_msg)
RuntimeError: Failed to build module
/home/varadarajan/softwares/Pyccel/my_progs/__pyccel__/test1_template.f90:162:8:

  162 |     c = a
      |        1
Warning: Extension: Conversion from INTEGER(4) to LOGICAL(1) at (1)
/home/varadarajan/softwares/Pyccel/my_progs/__pyccel__/test1_template.f90:146:8:

  146 |     c = a
      |        1
Warning: Extension: Conversion from INTEGER(1) to LOGICAL(1) at (1)
/home/varadarajan/softwares/Pyccel/my_progs/__pyccel__/test1_template.f90:114:8:

  114 |     c = a
      |        1
Warning: Extension: Conversion from INTEGER(8) to LOGICAL(1) at (1)
/home/varadarajan/softwares/Pyccel/my_progs/__pyccel__/test1_template.f90:98:8:

   98 |     c = a
      |        1
Warning: Extension: Conversion from INTEGER(2) to LOGICAL(1) at (1)
/home/varadarajan/softwares/Pyccel/my_progs/__pyccel__/test1_template.f90:82:8:

   82 |     c = a
      |        1
Error: Cannot convert REAL(4) to LOGICAL(1) at (1)
/home/varadarajan/softwares/Pyccel/my_progs/__pyccel__/test1_template.f90:66:8:

   66 |     c = a
      |        1
Error: Cannot convert COMPLEX(8) to LOGICAL(1) at (1)
/home/varadarajan/softwares/Pyccel/my_progs/__pyccel__/test1_template.f90:50:8:

   50 |     c = a
      |        1
Error: Cannot convert COMPLEX(4) to LOGICAL(1) at (1)
/home/varadarajan/softwares/Pyccel/my_progs/__pyccel__/test1_template.f90:34:8:

   34 |     c = a
      |        1
Error: Cannot convert REAL(8) to LOGICAL(1) at (1)
```

### Expected behavior
An error message why it cannot create a fortran executable. 

### Language
Fortran

### Additional context
If there is an bug id which tracks this issue, I can update the Pytest fortran skip part for #1762


Pull request:
Fix boolean cast in Fortran code
Add missing cast when creating an array from an object with a different datatype. Fixes #1785 

In order to call the cast on the argument passed to `np.array` (which may be a `InhomogeneousTupleType`) fix the type of the cast functions. 

Modify `InhomogeneousTupleType.datatype` to return a `FixedSizeType` if the datatypes of all elements are equivalent.

Also fix some minor bugs after #1756

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6765b21f..28409842 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file.
 -   #1792 : Fix array unpacking.
 -   #1795 : Fix bug when returning slices in C.
 -   #1732 : Fix multidimensional list indexing in Python.
+-   #1785 : Add missing cast when creating an array of booleans from non-boolean values.
 
 ### Changed
 -   #1720 : functions with the `@inline` decorator are no longer exposed to Python in the shared library.
diff --git a/pyccel/ast/builtins.py b/pyccel/ast/builtins.py
index 8866f468..e8399de3 100644
--- a/pyccel/ast/builtins.py
+++ b/pyccel/ast/builtins.py
@@ -513,11 +513,6 @@ class PythonTuple(TypedAstNode):
 
         # Get possible datatypes
         dtypes = [a.class_type.datatype for a in args]
-        # Extract all dtypes inside any inhomogeneous tuples
-        while any(isinstance(d, InhomogeneousTupleType) for d in dtypes):
-            dtypes = [di for d in dtypes for di in ((d_elem.datatype for d_elem in d)
-                                                    if isinstance(d, InhomogeneousTupleType)
-                                                    else [d])]
         # Create a set of dtypes using the same key for compatible types
         dtypes = set((d.primitive_type, d.precision) if isinstance(d, FixedSizeNumericType) else d for d in dtypes)
 
diff --git a/pyccel/ast/datatypes.py b/pyccel/ast/datatypes.py
index 9c903948..03f9576f 100644
--- a/pyccel/ast/datatypes.py
+++ b/pyccel/ast/datatypes.py
@@ -714,10 +714,14 @@ class InhomogeneousTupleType(ContainerType, TupleType, metaclass = ArgumentSingl
     *args : tuple of DataTypes
         The datatypes stored in the inhomogeneous tuple.
     """
-    __slots__ = ('_element_types',)
+    __slots__ = ('_element_types', '_datatype')
 
     def __init__(self, *args):
         self._element_types = args
+
+        possible_types = set(t.datatype for t in self._element_types)
+        dtype = possible_types.pop()
+        self._datatype = dtype if all(d == dtype for d in possible_types) else self
         super().__init__()
 
     def __str__(self):
@@ -754,13 +758,11 @@ class InhomogeneousTupleType(ContainerType, TupleType, metaclass = ArgumentSingl
         """
         The datatype of the object.
 
-        The datatype of the object.
+        The datatype of the object. For an inhomogeneous tuple the datatype is the type
+        of the tuple unless the tuple is comprised of containers which are all based on
+        compatible data types. In this case one of the underlying types is returned.
         """
-        possible_types = set(t.datatype for t in self._element_types)
-        if len(possible_types) == 1:
-            return possible_types.pop()
-        else:
-            return self
+        return self._datatype
 
 class DictType(ContainerType, metaclass = ArgumentSingleton):
     """
diff --git a/pyccel/ast/numpyext.py b/pyccel/ast/numpyext.py
index d4154e37..13f7a134 100644
--- a/pyccel/ast/numpyext.py
+++ b/pyccel/ast/numpyext.py
@@ -184,12 +184,14 @@ class NumpyFloat(PythonFloat):
         The argument passed to the function.
     """
     __slots__ = ('_rank','_shape','_order','_class_type')
+    _static_type = NumpyFloat64Type()
     name = 'float'
+
     def __init__(self, arg):
         self._shape = arg.shape
         self._rank  = arg.rank
         self._order = arg.order
-        self._class_type = arg.class_type.switch_basic_type(self.static_type())
+        self._class_type = NumpyNDArrayType(self.static_type()) if self._rank else self.static_type()
         super().__init__(arg)
 
     @property
@@ -250,7 +252,7 @@ class NumpyBool(PythonBool):
         self._shape = arg.shape
         self._rank  = arg.rank
         self._order = arg.order
-        self._class_type = arg.class_type.switch_basic_type(self.static_type())
+        self._class_type = NumpyNDArrayType(self.static_type()) if self._rank else self.static_type()
         super().__init__(arg)
 
     @property
@@ -277,12 +279,14 @@ class NumpyInt(PythonInt):
         The argument passed to the function.
     """
     __slots__ = ('_shape','_rank','_order','_class_type')
+    _static_type = numpy_precision_map[(PrimitiveIntegerType(), PythonInt._static_type.precision)]
     name = 'int'
+
     def __init__(self, arg=None, base=10):
         self._shape = arg.shape
         self._rank  = arg.rank
         self._order = arg.order
-        self._class_type = arg.class_type.switch_basic_type(self.static_type())
+        self._class_type = NumpyNDArrayType(self.static_type()) if self._rank else self.static_type()
         super().__init__(arg)
 
     @property
@@ -374,7 +378,10 @@ class NumpyReal(PythonReal):
     name = 'real'
     def __new__(cls, arg):
         if isinstance(arg.dtype, PythonNativeBool):
-            return NumpyInt(arg)
+            if arg.rank:
+                return NumpyInt(arg)
+            else:
+                return PythonInt(arg)
         else:
             return super().__new__(cls, arg)
 
@@ -452,14 +459,16 @@ class NumpyComplex(PythonComplex):
     _real_cast = NumpyReal
     _imag_cast = NumpyImag
     __slots__ = ('_rank','_shape','_order','_class_type')
+    _static_type = NumpyComplex128Type()
     name = 'complex'
+
     def __init__(self, arg0, arg1 = None):
         if arg1 is not None:
             raise NotImplementedError("Use builtin complex function not deprecated np.complex")
         self._shape = arg0.shape
         self._rank  = arg0.rank
         self._order = arg0.order
-        self._class_type = arg0.class_type.switch_basic_type(self.static_type())
+        self._class_type = NumpyNDArrayType(self.static_type()) if self._rank else self.static_type()
         super().__init__(arg0)
 
     @property
diff --git a/pyccel/codegen/printing/ccode.py b/pyccel/codegen/printing/ccode.py
index 88794c13..a8b277e1 100644
--- a/pyccel/codegen/printing/ccode.py
+++ b/pyccel/codegen/printing/ccode.py
@@ -1242,7 +1242,7 @@ class CCodePrinter(CodePrinter):
             else:
                 errors.report(PYCCEL_RESTRICTION_TODO+' (rank>0)', symbol=expr, severity='fatal')
         elif not isinstance(class_type, CustomDataType):
-            dtype = self.find_in_dtype_registry(class_type)
+            dtype = self.find_in_dtype_registry(expr.dtype)
         else:
             dtype = self._print(expr.class_type)
 
diff --git a/pyccel/codegen/printing/fcode.py b/pyccel/codegen/printing/fcode.py
index 9a6766d6..dc86daf7 100644
--- a/pyccel/codegen/printing/fcode.py
+++ b/pyccel/codegen/printing/fcode.py
@@ -1190,12 +1190,17 @@ class FCodePrinter(CodePrinter):
         return stmt
 
     def _print_NumpyArray(self, expr):
-        expr_args = (expr.arg,) if isinstance(expr.arg, Variable) else expr.arg
         order = expr.order
+
+        try :
+            cast_func = DtypePrecisionToCastFunction[expr.dtype]
+        except KeyError:
+            errors.report(PYCCEL_RESTRICTION_TODO, severity='fatal')
+        arg = expr.arg if expr.arg.dtype == expr.dtype else cast_func(expr.arg)
         # If Numpy array is stored with column-major ordering, transpose values
         # use reshape with order for rank > 2
         if expr.rank <= 2:
-            rhs_code = self._print(expr.arg)
+            rhs_code = self._print(arg)
             if expr.arg.order and expr.arg.order != expr.order:
                 rhs_code = f'transpose({rhs_code})'
             if expr.arg.rank < expr.rank:
@@ -1205,6 +1210,8 @@ class FCodePrinter(CodePrinter):
                     shape_code = ', '.join(self._print(i) for i in expr.shape[::-1])
                 rhs_code = f"reshape({rhs_code}, [{shape_code}])"
         else:
+            expr_args = (expr.arg,) if isinstance(expr.arg, Variable) else expr.arg
+            expr_args = tuple(a if a.dtype == expr.dtype else cast_func(a) for a in expr_args)
             new_args = []
             inv_order = 'C' if order == 'F' else 'F'
             for a in expr_args:


Test patch:
diff --git a/tests/epyccel/modules/python_annotations.py b/tests/epyccel/modules/python_annotations.py
index 746ff267..c3f79ad9 100644
--- a/tests/epyccel/modules/python_annotations.py
+++ b/tests/epyccel/modules/python_annotations.py
@@ -12,13 +12,13 @@ def array_int32_2d_F_add( x:'int32[:,:](order=F)', y:'int32[:,:](order=F)' ):
 def array_int_1d_scalar_add( x:'int[:]', a:'int' ):
     x[:] += a
 
-def array_real_1d_scalar_add( x:'real[:]', a:'real' ):
+def array_float_1d_scalar_add( x:'float[:]', a:'float' ):
     x[:] += a
 
-def array_real_2d_F_scalar_add( x:'real[:,:](order=F)', a:'real' ):
+def array_float_2d_F_scalar_add( x:'float[:,:](order=F)', a:'float' ):
     x[:,:] += a
 
-def array_real_2d_F_add( x:'real[:,:](order=F)', y:'real[:,:](order=F)'  ):
+def array_float_2d_F_add( x:'float[:,:](order=F)', y:'float[:,:](order=F)'  ):
     x[:,:] += y
 
 def array_int32_2d_F_complex_3d_expr( x:'int32[:,:](order=F)', y:'int32[:,:](order=F)' ):
@@ -26,7 +26,7 @@ def array_int32_2d_F_complex_3d_expr( x:'int32[:,:](order=F)', y:'int32[:,:](ord
     z = full((2,3),5,order='F', dtype=int32)
     x[:] = (x // y) * x + z
 
-def array_real_1d_complex_3d_expr( x:'real[:]', y:'real[:]' ):
+def array_float_1d_complex_3d_expr( x:'float[:]', y:'float[:]' ):
     from numpy import full
     z = full(3,5)
     x[:] = (x // y) * x + z
diff --git a/tests/epyccel/recognised_functions/test_numpy_funcs.py b/tests/epyccel/recognised_functions/test_numpy_funcs.py
index 7f256d72..e4757c25 100644
--- a/tests/epyccel/recognised_functions/test_numpy_funcs.py
+++ b/tests/epyccel/recognised_functions/test_numpy_funcs.py
@@ -2160,25 +2160,26 @@ def test_array(language):
     tmp_arr = np.ones((3,4), dtype=int)
     assert np.allclose(array_tuple_ref(tmp_arr), create_array_tuple_ref(tmp_arr))
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = pytest.mark.fortran),
-        pytest.param("c", marks = [
-            pytest.mark.skip(reason="Changing dtype is broken in C. See #1641"),
-            pytest.mark.c]
-        ),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_array_new_dtype(language):
     def create_float_array_tuple_ref(a : 'int[:,:]'):
         from numpy import array
         b = (a[0,:], a[1,:])
         c = array(b, dtype=float)
         return c
+    def create_bool_array_tuple_ref(a : 'int[:,:]'):
+        from numpy import array
+        b = (a[0,:], a[1,:])
+        c = array(b, dtype=bool)
+        return c
+
     array_float_tuple_ref = epyccel(create_float_array_tuple_ref, language = language)
     tmp_arr = np.ones((3,4), dtype=int)
     assert np.allclose(array_float_tuple_ref(tmp_arr), create_float_array_tuple_ref(tmp_arr))
 
+    array_bool_tuple_ref = epyccel(create_float_array_tuple_ref, language = language)
+    tmp_arr = np.ones((3,4), dtype=int)
+    assert np.allclose(array_bool_tuple_ref(tmp_arr), create_bool_array_tuple_ref(tmp_arr))
+
 @pytest.mark.parametrize( 'language', (
         pytest.param("fortran", marks = pytest.mark.fortran),
         pytest.param("c", marks = [
diff --git a/tests/epyccel/test_array_as_func_args.py b/tests/epyccel/test_array_as_func_args.py
index 194d269d..879eadb9 100644
--- a/tests/epyccel/test_array_as_func_args.py
+++ b/tests/epyccel/test_array_as_func_args.py
@@ -31,12 +31,12 @@ def test_array_int_1d_scalar_add(language):
 
         assert np.array_equal( x1, x2 )
 
-def test_array_real_1d_scalar_add(language):
-    @template('T', ['float32', 'double'])
-    def array_real_1d_scalar_add(x : 'T[:]', a : 'T', x_len : int):
+def test_array_float_1d_scalar_add(language):
+    @template('T', ['float32', 'float'])
+    def array_float_1d_scalar_add(x : 'T[:]', a : 'T', x_len : int):
         for i in range(x_len):
             x[i] += a
-    f1 = array_real_1d_scalar_add
+    f1 = array_float_1d_scalar_add
     f2 = epyccel(f1, language=language)
 
     for t in float_types:
@@ -92,13 +92,13 @@ def test_array_int_2d_scalar_add(language):
 
         assert np.array_equal( x1, x2 )
 
-def test_array_real_2d_scalar_add(language):
-    @template('T', ['float32', 'double'])
-    def array_real_2d_scalar_add(x : 'T[:,:]', a : 'T', d1 : int, d2 : int):
+def test_array_float_2d_scalar_add(language):
+    @template('T', ['float32', 'float'])
+    def array_float_2d_scalar_add(x : 'T[:,:]', a : 'T', d1 : int, d2 : int):
         for i in range(d1):
             for j in range(d2):
                 x[i, j] += a
-    f1 = array_real_2d_scalar_add
+    f1 = array_float_2d_scalar_add
     f2 = epyccel(f1, language=language)
 
     for t in float_types:
diff --git a/tests/epyccel/test_arrays.py b/tests/epyccel/test_arrays.py
index 77324a9b..5320bda4 100644
--- a/tests/epyccel/test_arrays.py
+++ b/tests/epyccel/test_arrays.py
@@ -3970,14 +3970,6 @@ def test_array_ndmin_2_order(language):
     check_array_equal(f1(d), f2(d))
     check_array_equal(f1(e), f2(e))
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_dtype_conversion_to_bool_from_other_types(language):
     size = (2, 2)
 
@@ -4172,14 +4164,6 @@ def test_dtype_conversion_to_int64_from_other_types(language):
     assert epyccel_func(cmplx64) == arrays.dtype_convert_to_int64(cmplx64)
     assert epyccel_func(cmplx128) == arrays.dtype_convert_to_int64(cmplx128)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_dtype_conversion_to_float32_from_other_types(language):
     size = (2, 2)
 
@@ -4214,14 +4198,6 @@ def test_dtype_conversion_to_float32_from_other_types(language):
     assert epyccel_func(cmplx64) == arrays.dtype_convert_to_float32(cmplx64)
     assert epyccel_func(cmplx128) == arrays.dtype_convert_to_float32(cmplx128)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_dtype_conversion_to_float64_from_other_types(language):
     size = (2, 2)
 
@@ -4256,14 +4232,6 @@ def test_dtype_conversion_to_float64_from_other_types(language):
     assert epyccel_func(cmplx64) == arrays.dtype_convert_to_float64(cmplx64)
     assert epyccel_func(cmplx128) == arrays.dtype_convert_to_float64(cmplx128)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_dtype_conversion_to_complex64_from_other_types(language):
     size = (2, 2)
 
@@ -4297,14 +4265,6 @@ def test_dtype_conversion_to_complex64_from_other_types(language):
     assert epyccel_func(cmplx64) == arrays.dtype_convert_to_cfloat(cmplx64)
     assert epyccel_func(cmplx128) == arrays.dtype_convert_to_cfloat(cmplx128)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_dtype_conversion_to_complex128_from_other_types(language):
     size = (2, 2)
 
@@ -4379,14 +4339,6 @@ def test_dtype_conversion_to_pyint_from_other_types(language):
     assert epyccel_func(cmplx64) == arrays.dtype_convert_to_pyint(cmplx64)
     assert epyccel_func(cmplx128) == arrays.dtype_convert_to_pyint(cmplx128)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_dtype_conversion_to_pyfloat_from_other_types(language):
     size = (2, 2)
 
@@ -4421,14 +4373,6 @@ def test_dtype_conversion_to_pyfloat_from_other_types(language):
     assert epyccel_func(cmplx64) == arrays.dtype_convert_to_pyfloat(cmplx64)
     assert epyccel_func(cmplx128) == arrays.dtype_convert_to_pyfloat(cmplx128)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_bool(language):
     size = (1,2)
 
@@ -4774,14 +4718,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_int64(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_int64(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_int64(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_float32(language):
     size = (1,2)
 
@@ -4851,14 +4787,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_float32(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_float32(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_float32(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_float64(language):
     size = (1,2)
 
@@ -4928,14 +4856,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_float64(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_float64(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_float64(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_cfloat(language):
     size = (1,2)
 
@@ -5005,14 +4925,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_cfloat(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_cfloat(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_cfloat(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_cdouble(language):
     size = (1,2)
 
@@ -5151,14 +5063,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_pyint(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_pyint(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_pyint(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_pyfloat(language):
     size = (1,2)
 
@@ -5228,14 +5132,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_pyfloat(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_pyfloat(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_pyfloat(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_bool_orderF(language):
     size = (1,2)
 
@@ -5581,14 +5477,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_int64_orderF(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_int64_orderF(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_int64_orderF(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_float32_orderF(language):
     size = (1,2)
 
@@ -5658,14 +5546,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_float32_orderF(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_float32_orderF(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_float32_orderF(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_float64_orderF(language):
     size = (1,2)
 
@@ -5735,14 +5615,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_float64_orderF(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_float64_orderF(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_float64_orderF(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_cfloat_orderF(language):
     size = (1,2)
 
@@ -5812,14 +5684,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_cfloat_orderF(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_cfloat_orderF(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_cfloat_orderF(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-            pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_cdouble_orderF(language):
     size = (1,2)
 
@@ -5958,14 +5822,6 @@ def test_src_dest_array_diff_sizes_dtype_conversion_to_pyint_orderF(language):
     assert epyccel_func(cmplx64_1, cmplx64_2, cmplx64_3) == arrays.src_dest_diff_sizes_dtype_convert_to_pyint_orderF(cmplx64_1, cmplx64_2, cmplx64_3)
     assert epyccel_func(cmplx128_1, cmplx128_2, cmplx128_3) == arrays.src_dest_diff_sizes_dtype_convert_to_pyint_orderF(cmplx128_1, cmplx128_2, cmplx128_3)
 
-@pytest.mark.parametrize( 'language', (
-        pytest.param("fortran", marks = [
-            pytest.mark.skip(reason=("Missing boolean cast in Fortran code, see #1785")),
-                      pytest.mark.fortran]),
-        pytest.param("c", marks = pytest.mark.c),
-        pytest.param("python", marks = pytest.mark.python)
-    )
-)
 def test_src_dest_array_diff_sizes_dtype_conversion_to_pyfloat_orderF(language):
     size = (1,2)
 
diff --git a/tests/epyccel/test_epyccel_python_annotations.py b/tests/epyccel/test_epyccel_python_annotations.py
index 51b50bd4..dfe2915f 100644
--- a/tests/epyccel/test_epyccel_python_annotations.py
+++ b/tests/epyccel/test_epyccel_python_annotations.py
@@ -61,9 +61,9 @@ def test_array_int_1d_scalar_add(language):
 
     assert np.array_equal( x1, x2 )
 
-def test_array_real_1d_scalar_add(language):
+def test_array_float_1d_scalar_add(language):
 
-    f1 = python_annotations.array_real_1d_scalar_add
+    f1 = python_annotations.array_float_1d_scalar_add
     f2 = epyccel( f1, language = language )
 
     x1 = np.array( [1.,2.,3.] )
@@ -76,9 +76,9 @@ def test_array_real_1d_scalar_add(language):
     assert np.array_equal( x1, x2 )
 
 
-def test_array_real_2d_F_scalar_add(language):
+def test_array_float_2d_F_scalar_add(language):
 
-    f1 = python_annotations.array_real_2d_F_scalar_add
+    f1 = python_annotations.array_float_2d_F_scalar_add
     f2 = epyccel( f1, language = language )
 
     x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' )
@@ -90,9 +90,9 @@ def test_array_real_2d_F_scalar_add(language):
 
     assert np.array_equal( x1, x2 )
 
-def test_array_real_2d_F_add(language):
+def test_array_float_2d_F_add(language):
 
-    f1 = python_annotations.array_real_2d_F_add
+    f1 = python_annotations.array_float_2d_F_add
     f2 = epyccel( f1, language = language )
 
     x1 = np.array( [[1.,2.,3.], [4.,5.,6.]], order='F' )
@@ -118,9 +118,9 @@ def test_array_int32_2d_F_complex_3d_expr(language):
 
     assert np.array_equal( x1, x2 )
 
-def test_array_real_1d_complex_3d_expr(language):
+def test_array_float_1d_complex_3d_expr(language):
 
-    f1 = python_annotations.array_real_1d_complex_3d_expr
+    f1 = python_annotations.array_float_1d_complex_3d_expr
     f2 = epyccel( f1, language = language )
 
     x1 = np.array( [1.,2.,3.] )