Skip to content

Commit 3f13b80

Browse files
committedSep 14, 2021
ensure all cases are covered by appropriate exception handling
1 parent 4ccbd1e commit 3f13b80

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎isort/parse.py

+4
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
447447
f"could not place module {import_from} of line {line} --"
448448
" Do you need to define a default section?"
449449
)
450+
451+
if placed_module and placed_module not in imports:
452+
raise MissingSection(import_module=import_from, section=placed_module)
453+
450454
root = imports[placed_module][type_of_import] # type: ignore
451455
for import_name in just_imports:
452456
associated_comment = nested_comments.get(import_name)

0 commit comments

Comments
 (0)
Please sign in to comment.