def test_include_launch_description_launch_file_location(): """Test the ability of the IncludeLaunchDescription class to set the launch file location.""" ld = LaunchDescription() action = IncludeLaunchDescription(LaunchDescriptionSource(ld, '<script>')) assert 'IncludeLaunchDescription' in action.describe() assert isinstance(action.describe_sub_entities(), list) assert isinstance(action.describe_conditional_sub_entities(), list) lc1 = LaunchContext() # Result should only contain the launch description as there are no launch arguments. assert action.visit(lc1) == [ld] assert lc1.locals.current_launch_file_directory == '<script>' assert action.get_asyncio_future() is None this_file = os.path.abspath(__file__) ld2 = LaunchDescription() action2 = IncludeLaunchDescription(LaunchDescriptionSource(ld2, this_file)) assert 'IncludeLaunchDescription' in action2.describe() assert isinstance(action2.describe_sub_entities(), list) assert isinstance(action2.describe_conditional_sub_entities(), list) lc2 = LaunchContext() # Result should only contain the launch description as there are no launch arguments. assert action2.visit(lc2) == [ld2] assert lc2.locals.current_launch_file_directory == os.path.dirname( this_file) assert action2.get_asyncio_future() is None
def test_include_launch_description_methods(): """Test the methods of the IncludeLaunchDescription class.""" ld = LaunchDescription() action = IncludeLaunchDescription(LaunchDescriptionSource(ld)) assert 'IncludeLaunchDescription' in action.describe() assert isinstance(action.describe_sub_entities(), list) assert isinstance(action.describe_conditional_sub_entities(), list) assert action.visit(LaunchContext()) == [ld] assert action.get_asyncio_future() is None ld2 = LaunchDescription([action]) action2 = IncludeLaunchDescription(LaunchDescriptionSource(ld2)) assert 'IncludeLaunchDescription' in action2.describe() assert isinstance(action2.describe_sub_entities(), list) assert isinstance(action2.describe_conditional_sub_entities(), list) assert action2.visit(LaunchContext()) == [ld2] assert action2.get_asyncio_future() is None
def test_include_launch_description_methods(): """Test the methods of the IncludeLaunchDescription class.""" ld = LaunchDescription() action = IncludeLaunchDescription(LaunchDescriptionSource(ld)) assert 'IncludeLaunchDescription' in action.describe() assert isinstance(action.describe_sub_entities(), list) assert isinstance(action.describe_conditional_sub_entities(), list) # Result should only contain the launch description as there are no launch arguments. assert action.visit(LaunchContext()) == [ld] assert action.get_asyncio_future() is None assert len(action.launch_arguments) == 0 ld2 = LaunchDescription([action]) action2 = IncludeLaunchDescription(LaunchDescriptionSource(ld2)) assert 'IncludeLaunchDescription' in action2.describe() assert isinstance(action2.describe_sub_entities(), list) assert isinstance(action2.describe_conditional_sub_entities(), list) # Result should only contain the launch description as there are no launch arguments. assert action2.visit(LaunchContext()) == [ld2] assert action2.get_asyncio_future() is None assert len(action2.launch_arguments) == 0