diff --git a/sdk/communication/azure-communication-identity/tests/_shared/testcase.py b/sdk/communication/azure-communication-identity/tests/_shared/testcase.py index c06c0bf5b1a5..bd1fbecc5750 100644 --- a/sdk/communication/azure-communication-identity/tests/_shared/testcase.py +++ b/sdk/communication/azure-communication-identity/tests/_shared/testcase.py @@ -51,13 +51,12 @@ def process_response(self, response): def _replace_keys(self, body): def _replace_recursively(dictionary): - if type(dictionary) != dict: - return for key in dictionary: + value = dictionary[key] if key in self._keys: dictionary[key] = self._replacement - else: - _replace_recursively(dictionary[key]) + elif isinstance(value, dict): + _replace_recursively(value) import json try: