File tree 2 files changed +6
-6
lines changed
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -107,19 +107,19 @@ def __init__(
107
107
** kw , # To catch unknown keywords
108
108
):
109
109
if not isinstance (name , str ):
110
- raise AssertionError ("'name' must be a string" ) # noqa: TRY004
110
+ raise TypeError ("'name' must be a string" ) # noqa: TRY004
111
111
112
112
# handle the string case first; since strings are iterable, disallow them
113
113
if isinstance (sources , str ):
114
- raise AssertionError ( # noqa: TRY004
114
+ raise TypeError (
115
115
"'sources' must be an iterable of strings or PathLike objects, not a string"
116
116
)
117
117
118
118
# now we check if it's iterable and contains valid types
119
119
try :
120
120
self .sources = list (map (os .fspath , sources ))
121
121
except TypeError :
122
- raise AssertionError (
122
+ raise TypeError (
123
123
"'sources' must be an iterable of strings or PathLike objects"
124
124
)
125
125
Original file line number Diff line number Diff line change @@ -63,16 +63,16 @@ def test_read_setup_file(self):
63
63
64
64
def test_extension_init (self ):
65
65
# the first argument, which is the name, must be a string
66
- with pytest .raises (AssertionError ):
66
+ with pytest .raises (TypeError ):
67
67
Extension (1 , [])
68
68
ext = Extension ('name' , [])
69
69
assert ext .name == 'name'
70
70
71
71
# the second argument, which is the list of files, must
72
72
# be an iterable of strings or PathLike objects, and not a string
73
- with pytest .raises (AssertionError ):
73
+ with pytest .raises (TypeError ):
74
74
Extension ('name' , 'file' )
75
- with pytest .raises (AssertionError ):
75
+ with pytest .raises (TypeError ):
76
76
Extension ('name' , ['file' , 1 ])
77
77
ext = Extension ('name' , ['file1' , 'file2' ])
78
78
assert ext .sources == ['file1' , 'file2' ]
You can’t perform that action at this time.
0 commit comments