Skip to content

Commit ef03721

Browse files
test: adding tests asserting None is translated to "None". (#3694)
* test: adding tests asserting None are translated to "None". * chore: adding changelog file 3694.added.md [dependabot-skip] --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 2cb72c4 commit ef03721

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

doc/changelog.d/3694.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test: adding tests asserting None are translated to "None".

tests/test_mapdl.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2722,3 +2722,36 @@ def test_comment_on_debug_mode(mapdl, cleared):
27222722
mockcom.assert_called_once_with("Entering in non_interactive mode")
27232723

27242724
mapdl.logger.logger.level = loglevel
2725+
2726+
2727+
@pytest.mark.parametrize(
2728+
"cmd,arg",
2729+
(
2730+
("block", None),
2731+
("nsel", None),
2732+
("modopt", None),
2733+
),
2734+
)
2735+
def test_none_as_argument(mapdl, cmd, arg):
2736+
with patch.object(mapdl, "_run") as mock_run:
2737+
func = getattr(mapdl, cmd)
2738+
out = func(arg)
2739+
2740+
if "sel" in cmd:
2741+
assert isinstance(out, np.ndarray)
2742+
assert len(out) == 0
2743+
2744+
cmd = mock_run.call_args.args[0]
2745+
2746+
assert isinstance(cmd, str)
2747+
assert "NONE" in cmd.upper()
2748+
2749+
2750+
@pytest.mark.parametrize("func", ["ksel", "lsel", "asel", "vsel"])
2751+
def test_none_on_selecting(mapdl, cleared, func):
2752+
mapdl.block(0, 1, 0, 1, 0, 1)
2753+
2754+
selfunc = getattr(mapdl, func)
2755+
2756+
assert len(selfunc("all")) > 0
2757+
assert len(selfunc(None)) == 0

0 commit comments

Comments
 (0)