diff --git a/tests/cases/analyzer/statement/match_statement.py b/tests/cases/analyzer/statement/match_statement.py new file mode 100644 index 00000000..ba828db5 --- /dev/null +++ b/tests/cases/analyzer/statement/match_statement.py @@ -0,0 +1,17 @@ +from typing import List, Union + +from unimport.statement import Import, ImportFrom, Name + +__all__ = ["NAMES", "IMPORTS", "UNUSED_IMPORTS"] + + +NAMES: List[Name] = [ + Name(lineno=3, name='sort_by', is_all=False), + Name(lineno=4, name='sort_by', is_all=False), + Name(lineno=5, name='sort_by', is_all=False), +] +IMPORTS: List[Union[Import, ImportFrom]] = [ +] +UNUSED_IMPORTS: List[Union[Import, ImportFrom]] = [ + +] diff --git a/tests/cases/refactor/statement/match_statement.py b/tests/cases/refactor/statement/match_statement.py new file mode 100644 index 00000000..6cd40b23 --- /dev/null +++ b/tests/cases/refactor/statement/match_statement.py @@ -0,0 +1,5 @@ +# https://github.com/hakancelikdev/unimport/issues/291 + +match sort_by: + case 'date': sort_by = ' updated DESC,' + case _: sort_by = '' diff --git a/tests/cases/source/statement/match_statement.py b/tests/cases/source/statement/match_statement.py new file mode 100644 index 00000000..6cd40b23 --- /dev/null +++ b/tests/cases/source/statement/match_statement.py @@ -0,0 +1,5 @@ +# https://github.com/hakancelikdev/unimport/issues/291 + +match sort_by: + case 'date': sort_by = ' updated DESC,' + case _: sort_by = ''