diff options
| author | Timothy Crosley <timothy.crosley@gmail.com> | 2020-12-30 16:51:48 -0800 |
|---|---|---|
| committer | Timothy Crosley <timothy.crosley@gmail.com> | 2020-12-30 16:51:48 -0800 |
| commit | 8e70db8d0092c333c112f0685bc9e416caab9d80 (patch) | |
| tree | b115f03dafe085fb4580f743221f02cb6bd684ed /tests/unit/test_identify.py | |
| parent | 0383c3668d289db2d41a43165b564f75bb5e64ff (diff) | |
| download | isort-8e70db8d0092c333c112f0685bc9e416caab9d80.tar.gz | |
100% test coverage for new identify module
Diffstat (limited to 'tests/unit/test_identify.py')
| -rw-r--r-- | tests/unit/test_identify.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/unit/test_identify.py b/tests/unit/test_identify.py index 64c9f28a..c2918b52 100644 --- a/tests/unit/test_identify.py +++ b/tests/unit/test_identify.py @@ -2,6 +2,7 @@ from io import StringIO from typing import List from isort import Config, identify +from isort.identify import Import def imports_in_code(code: str, **kwargs) -> List[identify.Import]: @@ -219,12 +220,37 @@ from os \\ from os ( import path ) +from os import \\ + path +from os \\ + import ( + path + ) from os import ( \\""" ) ) - == 7 + == 9 ) assert not imports_in_code("from os import \\") + assert ( + imports_in_code( + """ +from os \\ + import ( + system""" + ) + == [ + Import( + line_number=2, + indented=False, + module="os", + attribute="system", + alias=None, + cimport=False, + file_path=None, + ) + ] + ) def test_aliases(): |
