Skip to content

Commit 7da112f

Browse files
committed
Replace runtime assert in text.py
Signed-off-by: diwaaudi <audichyadiwa@gmail.com>
1 parent 5834b85 commit 7da112f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/commoncode/text.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,6 @@ def as_unicode(s):
142142
return ""
143143
if not s:
144144
return s
145-
assert isinstance(s, bytes), "s must be bytes but is: {}".format(s)
145+
if not isinstance(s, bytes):
146+
raise TypeError(f"s must be bytes, not {type(s).__name__}")
146147
return UnicodeDammit(s).unicode_markup

0 commit comments

Comments
 (0)