diff --git a/src/ansys/mapdl/core/misc.py b/src/ansys/mapdl/core/misc.py index d69c758ee3..2a4529bd5a 100644 --- a/src/ansys/mapdl/core/misc.py +++ b/src/ansys/mapdl/core/misc.py @@ -111,6 +111,9 @@ def check_valid_routine(routine): Raised when a routine is invalid. """ + if routine.lower().startswith("/"): + routine = routine[1:] + if routine.lower().startswith("begin"): return True if not hasattr(ROUTINES, routine.upper()): diff --git a/tests/test_misc.py b/tests/test_misc.py index defcd41fd8..b556dcafba 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -372,13 +372,17 @@ def myotherfun2(self): assert myclass.myotherfun2 is None -def test_check_valid_routine(): - assert check_valid_routine("prep7") - assert check_valid_routine("PREP7") - assert check_valid_routine("/PREP7") - assert check_valid_routine("begin level") +@pytest.mark.parametrize( + "routine", ["prep7", "PREP7", "/PREP7", "begin level", "BEGIN LEVEL"] +) +def test_check_valid_routine(routine): + assert check_valid_routine(routine) + + +@pytest.mark.parametrize("routine", ["invalid", "invalid routine", "prep78"]) +def test_check_valid_routine_invalid(routine): with pytest.raises(ValueError, match="Invalid routine"): - check_valid_routine("invalid") + check_valid_routine(routine) @requires("local")