Skip to content

Commit 98cf1fc

Browse files
committed
test(utils): Add test for to_string
Fixes: GH-3515
1 parent a2e9dd3 commit 98cf1fc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
_get_installed_modules,
3333
_generate_installed_modules,
3434
ensure_integration_enabled,
35+
to_string,
3536
)
3637

3738

@@ -1001,3 +1002,13 @@ def test_function(): ...
10011002
sentry_sdk.utils.qualname_from_function(test_function)
10021003
== "test_qualname_from_function_none_name.<locals>.test_function"
10031004
)
1005+
1006+
1007+
def test_to_string_unicode_decode_error():
1008+
class BadStr:
1009+
def __str__(self):
1010+
raise UnicodeDecodeError("utf-8", b"", 0, 1, "reason")
1011+
1012+
obj = BadStr()
1013+
result = to_string(obj)
1014+
assert result == repr(obj)[1:-1]

0 commit comments

Comments
 (0)