Skip to content

Commit ad65a86

Browse files
author
Sakthivel Ramasamy (sakthram)
committed
Correct error messages
1 parent 3148e5a commit ad65a86

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/webexpythonsdk/models/cards/utils.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def check_type(
5858
error_message = (
5959
"We were expecting to receive a list of objects of the "
6060
"following types: "
61-
f"{", ".join([repr(t.__name__) for t in acceptable_types])}"
62-
f"{" or 'None'" if optional else ""}; instead we received "
61+
f"{', '.join([repr(t.__name__) for t in acceptable_types])}"
62+
f"{' or \'None\'' if optional else ''}; instead we received "
6363
f"{obj} which is a {repr(type(obj).__name__)}."
6464
)
6565
raise TypeError(error_message)
@@ -69,8 +69,8 @@ def check_type(
6969
error_message = (
7070
"We were expecting to receive an object of one of the "
7171
"following types: "
72-
f"{", ".join(repr(t.__name__) for t in acceptable_types)}"
73-
f"{" or 'None'" if optional else ""}; instead we "
72+
f"{', '.join(repr(t.__name__) for t in acceptable_types)}"
73+
f"{' or \'None\'' if optional else ''}; instead we "
7474
f"received {o} which is a {repr(type(o).__name__)}."
7575
)
7676
raise TypeError(error_message)
@@ -81,8 +81,8 @@ def check_type(
8181
else:
8282
error_message = (
8383
"We were expecting to receive an instance of one of the following "
84-
f"types: {", ".join(repr(t.__name__) for t in acceptable_types)}"
85-
f"{" or 'None'" if optional else ""}; but instead we received "
84+
f"types: {', '.join(repr(t.__name__) for t in acceptable_types)}"
85+
f"{' or \'None\'' if optional else ''}; but instead we received "
8686
f"{obj} which is a {repr(type(obj).__name__)}."
8787
)
8888

@@ -140,7 +140,7 @@ def validate_input(
140140
# Check if the value is in the tuple of allowed values
141141
if value_to_check not in allowed_values:
142142
raise ValueError(
143-
f"Invalid value: \"{input_value}\". "
143+
f"Invalid value: '{input_value}'. "
144144
f"Must be one of {expected_values}."
145145
)
146146

@@ -172,20 +172,20 @@ def validate_dict_str(
172172
return
173173

174174
if not isinstance(input_value, dict):
175-
raise TypeError(f"\"{input_value}\" is not of type \"dict\"")
175+
raise TypeError(f"'{input_value}' is not of type 'dict'")
176176

177177
errors = []
178178

179179
for key, value in input_value.items():
180180
if not isinstance(key, key_type):
181181
errors.append(
182-
f"Key \"{key}\" of type \"{type(key).__name__}\" "
183-
f"is not of type \"{key_type.__name__}\"."
182+
f"Key '{key}' of type '{type(key).__name__}' "
183+
f"is not of type '{key_type.__name__}'."
184184
)
185185
if not isinstance(value, value_type):
186186
errors.append(
187-
f"Value \"{value}\" of type \"{type(value).__name__}\" "
188-
f"is not of type \"{value_type.__name__}\"."
187+
f"Value '{value}' of type '{type(value).__name__}' "
188+
f"is not of type '{value_type.__name__}'."
189189
)
190190

191191
if errors:
@@ -219,7 +219,7 @@ def validate_uri(
219219
return
220220

221221
if not isinstance(uri, str):
222-
raise TypeError(f"\"{uri}\" is not of type \"str\"")
222+
raise TypeError(f"'{uri}' is not of type 'str'")
223223

224224
# First validate using urlparse
225225
parsed_uri = urlparse(uri)

0 commit comments

Comments
 (0)