@@ -161,7 +161,21 @@ def test_package__both_mappings():
161
161
"""
162
162
],
163
163
None ,
164
- {"apache_airflow" : ["airflow" ], "attrs" : ["attr" , "attrs" ]},
164
+ {
165
+ "apache_airflow" : Package (
166
+ "apache_airflow" ,
167
+ {"User-defined mapping from {tmp_path}/mapping0.toml" : {"airflow" }},
168
+ ),
169
+ "attrs" : Package (
170
+ "attrs" ,
171
+ {
172
+ "User-defined mapping from {tmp_path}/mapping0.toml" : {
173
+ "attr" ,
174
+ "attrs" ,
175
+ }
176
+ },
177
+ ),
178
+ },
165
179
id = "well_formated_input_file__parses_correctly" ,
166
180
),
167
181
pytest .param (
@@ -177,9 +191,28 @@ def test_package__both_mappings():
177
191
],
178
192
None ,
179
193
{
180
- "apache_airflow" : ["airflow" , "baz" ],
181
- "attrs" : ["attr" , "attrs" ],
182
- "foo" : ["bar" ],
194
+ "apache_airflow" : Package (
195
+ "apache_airflow" ,
196
+ {
197
+ "User-defined mapping from {tmp_path}/mapping0.toml" : {
198
+ "airflow"
199
+ },
200
+ "User-defined mapping from {tmp_path}/mapping1.toml" : {"baz" },
201
+ },
202
+ ),
203
+ "attrs" : Package (
204
+ "attrs" ,
205
+ {
206
+ "User-defined mapping from {tmp_path}/mapping0.toml" : {
207
+ "attr" ,
208
+ "attrs" ,
209
+ }
210
+ },
211
+ ),
212
+ "foo" : Package (
213
+ "foo" ,
214
+ {"User-defined mapping from {tmp_path}/mapping1.toml" : {"bar" }},
215
+ ),
183
216
},
184
217
id = "well_formated_input_2files__parses_correctly" ,
185
218
),
@@ -196,9 +229,29 @@ def test_package__both_mappings():
196
229
],
197
230
{"apache-airflow" : ["unicorn" ]},
198
231
{
199
- "apache_airflow" : ["airflow" , "baz" , "unicorn" ],
200
- "attrs" : ["attr" , "attrs" ],
201
- "foo" : ["bar" ],
232
+ "apache_airflow" : Package (
233
+ "apache_airflow" ,
234
+ {
235
+ "User-defined mapping from {tmp_path}/mapping0.toml" : {
236
+ "airflow"
237
+ },
238
+ "User-defined mapping from {tmp_path}/mapping1.toml" : {"baz" },
239
+ "User-defined mapping from settings" : {"unicorn" },
240
+ },
241
+ ),
242
+ "attrs" : Package (
243
+ "attrs" ,
244
+ {
245
+ "User-defined mapping from {tmp_path}/mapping0.toml" : {
246
+ "attr" ,
247
+ "attrs" ,
248
+ }
249
+ },
250
+ ),
251
+ "foo" : Package (
252
+ "foo" ,
253
+ {"User-defined mapping from {tmp_path}/mapping1.toml" : {"bar" }},
254
+ ),
202
255
},
203
256
id = "well_formated_input_2files_and_config__parses_correctly" ,
204
257
),
@@ -219,8 +272,8 @@ def test_user_defined_mapping__well_formated_input_file__parses_correctly(
219
272
udm = UserDefinedMapping (
220
273
mapping_paths = custom_mapping_files , custom_mapping = custom_mapping
221
274
)
222
- mapped_packages = { k : sorted ( list ( v . import_names )) for k , v in udm . packages . items ()}
223
- assert mapped_packages == expect
275
+ expect = expand_package_mappings_placeholders ( expect , tmp_path = tmp_path )
276
+ assert udm . packages == expect
224
277
225
278
226
279
def test_user_defined_mapping__input_is_no_file__raises_unparsable_path_exeption ():
0 commit comments