Skip to content

Commit

Permalink
use json.dumps() instead of str()
Browse files Browse the repository at this point in the history
  • Loading branch information
Tawakalt committed Feb 9, 2024
1 parent 58a3199 commit 5a7c1b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion rasa_sdk/tracing/instrumentation/attribute_extractors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

from typing import Any, Dict, Text
from rasa_sdk.executor import ActionExecutor, CollectingDispatcher
from rasa_sdk.forms import ValidationAction
Expand Down Expand Up @@ -51,6 +53,6 @@ def extract_attrs_for_validation_action(
return {
"class_name": self.__class__.__name__,
"sender_id": tracker.sender_id,
"slots_to_validate": str(slots_to_validate),
"slots_to_validate": json.dumps(list(slots_to_validate)),
"action_name": self.name(),
}
4 changes: 2 additions & 2 deletions tests/tracing/instrumentation/test_validation_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
@pytest.mark.parametrize(
"events, expected_slots_to_validate",
[
([], "dict_keys([])"),
([], "[]"),
(
[SlotSet("name", "Tom"), SlotSet("address", "Berlin")],
"dict_keys(['name', 'address'])",
'["name", "address"]',
),
],
)
Expand Down

0 comments on commit 5a7c1b8

Please sign in to comment.