@@ -69,7 +69,7 @@ def test_extension_init(self):
69
69
assert ext .name == 'name'
70
70
71
71
# the second argument, which is the list of files, must
72
- # be a list of strings or PathLike objects
72
+ # be a list of strings or PathLike objects, and not a string
73
73
with pytest .raises (AssertionError ):
74
74
Extension ('name' , 'file' )
75
75
with pytest .raises (AssertionError ):
@@ -79,6 +79,16 @@ def test_extension_init(self):
79
79
ext = Extension ('name' , [pathlib .Path ('file1' ), pathlib .Path ('file2' )])
80
80
assert ext .sources == ['file1' , 'file2' ]
81
81
82
+ # any non-string iterable of strings or PathLike objects should work
83
+ ext = Extension ('name' , ('file1' , 'file2' )) # tuple
84
+ assert ext .sources == ['file1' , 'file2' ]
85
+ ext = Extension ('name' , {'file1' , 'file2' }) # set
86
+ assert sorted (ext .sources ) == ['file1' , 'file2' ]
87
+ ext = Extension ('name' , iter (['file1' , 'file2' ])) # iterator
88
+ assert ext .sources == ['file1' , 'file2' ]
89
+ ext = Extension ('name' , [pathlib .Path ('file1' ), 'file2' ]) # mixed types
90
+ assert ext .sources == ['file1' , 'file2' ]
91
+
82
92
# others arguments have defaults
83
93
for attr in (
84
94
'include_dirs' ,
0 commit comments