From e0cf6ad046a62865cca67e105ccd40ed6df3010d Mon Sep 17 00:00:00 2001 From: Filippo Luca Ferretti Date: Mon, 11 Nov 2024 17:47:59 +0100 Subject: [PATCH] Add additional test for non-existing string path --- tests/test_urdf_parsing.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/test_urdf_parsing.py b/tests/test_urdf_parsing.py index 4591693..87332a7 100644 --- a/tests/test_urdf_parsing.py +++ b/tests/test_urdf_parsing.py @@ -1,3 +1,5 @@ +import pathlib + import pytest import robot_descriptions import robot_descriptions.loaders.idyntree @@ -37,8 +39,11 @@ def test_urdf_parsing(robot: Robot) -> None: # Check that it fails is is_urdf=True and the resource is a non-existing path with pytest.raises(FileNotFoundError): - _ = rod.Sdf.load(sdf="/non/existing/path", is_urdf=None) - _ = rod.Sdf.load(sdf="/non/existing/path", is_urdf=False) + _ = rod.Sdf.load(sdf="/non/existing/path.sdf", is_urdf=False) + + # Check that it fails is is_urdf=True and the resource is an empty string + with pytest.raises(FileNotFoundError): + _ = rod.Sdf.load(sdf=pathlib.Path("/non/existing/path.sdf"), is_urdf=False) # The following instead should succeed _ = rod.Sdf.load(sdf=urdf_path, is_urdf=None) @@ -46,6 +51,18 @@ def test_urdf_parsing(robot: Robot) -> None: _ = rod.Sdf.load(sdf=str(urdf_path), is_urdf=None) _ = rod.Sdf.load(sdf=str(urdf_path), is_urdf=True) _ = rod.Sdf.load(sdf=urdf_path.read_text(), is_urdf=True) + _ = rod.Sdf.load( + sdf=" \ + \ + \ + \ + \ + \ + \ + \ + \ + " + ) # Load once again the urdf rod_sdf = rod.Sdf.load(sdf=urdf_path)