From 740b3fa5129ddffcc2b242bf447d95fcca5d48f4 Mon Sep 17 00:00:00 2001 From: Frederik Hennig <frederik.hennig@fau.de> Date: Fri, 24 Jan 2025 13:42:15 +0100 Subject: [PATCH] fix test_type_cast --- src/pystencils/sympyextensions/typed_sympy.py | 3 ++- tests/kernelcreation/test_type_cast.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pystencils/sympyextensions/typed_sympy.py b/src/pystencils/sympyextensions/typed_sympy.py index 509752bdf..290576368 100644 --- a/src/pystencils/sympyextensions/typed_sympy.py +++ b/src/pystencils/sympyextensions/typed_sympy.py @@ -207,10 +207,11 @@ class BoolCast(TypeCast, Boolean): tcast = TypeCast -class CastFunc(sp.Function): +class CastFunc(TypeCast): def __new__(cls, *args, **kwargs): warn( "CastFunc is deprecated and will be removed in pystencils 2.1. " "Use `pystencils.tcast` instead.", FutureWarning ) + return TypeCast.__new__(cls, *args, **kwargs) diff --git a/tests/kernelcreation/test_type_cast.py b/tests/kernelcreation/test_type_cast.py index 8ad6d8670..6b7acbbed 100644 --- a/tests/kernelcreation/test_type_cast.py +++ b/tests/kernelcreation/test_type_cast.py @@ -8,7 +8,7 @@ from pystencils import ( Assignment, Field, ) -from pystencils.sympyextensions.typed_sympy import CastFunc +from pystencils.sympyextensions.typed_sympy import tcast AVAIL_TARGETS_NO_SSE = [t for t in Target.available_targets() if Target._SSE not in t] @@ -55,7 +55,7 @@ def test_type_cast(gen_config, xp, from_type, to_type): inp_field = Field.create_from_numpy_array("inp", inp) outp_field = Field.create_from_numpy_array("outp", outp) - asms = [Assignment(outp_field.center(), CastFunc(inp_field.center(), to_type))] + asms = [Assignment(outp_field.center(), tcast(inp_field.center(), to_type))] kernel = create_kernel(asms, gen_config) kfunc = kernel.compile() -- GitLab