Repository: rasahq/rasa
Issue: `test_nlu` breaks when optional value isn't given

### Rasa Open Source version

3.0.4

### Rasa SDK version

 _No response_ 

### Rasa X version

 _No response_ 

### Python version

3.7

### What operating system are you using?

Linux

### What happened?

I am building smoke tests for rasa nlu examples and it seems that in the 3.0 transition some of the internal testing methods break if optional parameters are not passed.

Here's the script in particular.

<pre>import asyncio
 from rich.traceback import install
 from rasa.model_training import train_nlu
 from rasa.model_testing import test_nlu

install()

if __name__ == "__main__": 
 fp = "sparse-naive-bayes-intent-classifier-config.yml"
 mod = train_nlu(
 nlu_data="tests/data/nlu/en/nlu.yml",
 config=f"tests/configs/

 {fp}",

 output="models",

 )

 asyncio.run(test_nlu(model=mod, nlu_data="tests/data/nlu/en/nlu.yml", additional_arguments={}))</pre>

 The final line is the important one. If `additional_arguments` are not passed I get this traceback.

 <pre>╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮

 │ /home/vincent/Development/rasa-nlu-examples/scripts/train-nlu.py:17 in 

 │

 │ │

 │ 14 │ │ config=f"tests/configs/{fp} 

", │
 │ 15 │ │ output="models", │
 │ 16 │ ) │
 │ ❱ 17 │ asyncio.run(test_nlu(model=mod, nlu_data="tests/data/nlu/en/nlu.yml")) │
 │ 18 │
 │ │
 │ /usr/lib/python3.7/asyncio/runners.py:43 in run │
 │ │
 │ 40 │ try: │
 │ 41 │ │ events.set_event_loop(loop) │
 │ 42 │ │ loop.set_debug(debug) │
 │ ❱ 43 │ │ return loop.run_until_complete(main) │
 │ 44 │ finally: │
 │ 45 │ │ try: │
 │ 46 │ │ │ _cancel_all_tasks(loop) │
 │ │
 │ /home/vincent/Development/rasa-nlu-examples/uvloop/loop.pyx:1456 in │
 │ uvloop.loop.Loop.run_until_complete │
 │ │
 │ <span class="error">[Errno 2]</span> No such file or directory: │
 │ '/home/vincent/Development/rasa-nlu-examples/uvloop/loop.pyx' │
 │ │
 │ /home/vincent/Development/rasa-nlu-examples/venv/lib/python3.7/site-packages/rasa/model_testing. │
 │ py:212 in test_nlu │
 │ │
 │ 209 │ │
 │ 210 │ if os.path.exists(model) and metadata.training_type != TrainingType.CORE: │
 │ 211 │ │ kwargs = rasa.shared.utils.common.minimal_kwargs( │
 │ ❱ 212 │ │ │ additional_arguments, run_evaluation, <span class="error">["data_path", "model"]</span> │
 │ 213 │ │ ) │
 │ 214 │ │ _agent = Agent.load(model_path=model) │
 │ 215 │ │ await run_evaluation( │
 │ │
 │ /home/vincent/Development/rasa-nlu-examples/venv/lib/python3.7/site-packages/rasa/shared/utils/c │
 │ ommon.py:183 in minimal_kwargs │
 │ │
 │ 180 │ │
 │ 181 │ return 

 { │ │ 182 │ │ k: v │ │ ❱ 183 │ │ for k, v in kwargs.items() │ │ 184 │ │ if k in possible_arguments and k not in excluded_keys │ │ 185 │ } 

 │
 │ 186 │
 ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
 </pre>

The issue is that inside of `test_nlu` the `rasa.shared.utils.common.minimal_kwargs` function is called with this `additional_arguments`. If it is `None` it causes a breaking error which prevents me from testing my components.

I propose that we changed the `test_nlu` signature such that the `additional_arguments` is an empty dictionary if nothing is passed.

<pre>async def test_nlu(
 model: Optional<span class="error">[Text]</span>,
 nlu_data: Optional<span class="error">[Text]</span>,
 output_directory: Text = DEFAULT_RESULTS_PATH,
 additional_arguments: Optional<span class="error">[Dict]</span> = None,
 ) -> None:
 """Tests the NLU Model."""
 from rasa.nlu.test import run_evaluation

 rasa.shared.utils.io.create_directory(output_directory)</pre>

### Command / Request

 _No response_ 

### Relevant log output

 _No response_

Changed files:
rasa/model_testing.py, tests/test_model_testing.py

diff --git a/rasa/model_testing.py b/rasa/model_testing.py
index b07b3f75c4a..13836094146 100644
--- a/rasa/model_testing.py
+++ b/rasa/model_testing.py
@@ -208,6 +208,9 @@ async def test_nlu(
 
     rasa.shared.utils.io.create_directory(output_directory)
 
+    if not additional_arguments:
+        additional_arguments = {}
+
     try:
         model = rasa.model.get_local_model(model)
     except ModelNotFound:
diff --git a/tests/test_model_testing.py b/tests/test_model_testing.py
index a0e42bb08ac..da0dcb8696b 100644
--- a/tests/test_model_testing.py
+++ b/tests/test_model_testing.py
@@ -32,6 +32,7 @@ from rasa.shared.nlu.constants import (
     ENTITY_ATTRIBUTE_TYPE,
     ENTITY_ATTRIBUTE_TEXT,
 )
+from rasa.model_testing import test_nlu
 from rasa.shared.constants import LATEST_TRAINING_DATA_FORMAT_VERSION
 
 
@@ -639,3 +640,13 @@ def test_differently_ordered_entity_predictions_tolerated():
         entity_predictions=[entity1, entity2], entity_targets=[entity2, entity1]
     )
     assert not evaluation.check_prediction_target_mismatch()
+
+
+def test_nlu_can_handle_missing_additional_arguments():
+    """This is a regression test for issue-10587
+
+    Calling this function with no parameters should not cause it
+    to throw an error
+
+    """
+    test_nlu(model=None, nlu_data=None, additional_arguments=None)