Skip to content

Commit e02dcdc

Browse files
committed
Update test_as_unicode to expect TypeError
Signed-off-by: diwaaudi <audichyadiwa@gmail.com>
1 parent 7da112f commit e02dcdc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/test_text.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

10+
import pytest
11+
1012
from commoncode import text
1113
from commoncode.text import CR
1214
from commoncode.text import LF
@@ -85,12 +87,11 @@ def test_python_safe_name():
8587
assert text.python_safe_name(s2) == text.python_safe_name(s1)
8688

8789

90+
8891
def test_as_unicode():
8992
assert text.as_unicode("") == ""
9093
assert isinstance(text.as_unicode(b"some bytes"), str)
91-
assert text.as_unicode(None) == None
92-
try:
94+
assert text.as_unicode(None) is None
95+
96+
with pytest.raises(TypeError):
9397
text.as_unicode(["foo"])
94-
raise Exception("Exception should have been raised")
95-
except AssertionError:
96-
pass

0 commit comments

Comments
 (0)