From 98f4046426d221e17a0ca89f20e627ab09c8cdd2 Mon Sep 17 00:00:00 2001 From: Hakan Celik Date: Fri, 17 Nov 2023 23:55:50 +0300 Subject: [PATCH] #291 Add test --- .../cases/analyzer/statement/match_statement.py | 17 +++++++++++++++++ .../cases/refactor/statement/match_statement.py | 5 +++++ tests/cases/source/statement/match_statement.py | 5 +++++ 3 files changed, 27 insertions(+) create mode 100644 tests/cases/analyzer/statement/match_statement.py create mode 100644 tests/cases/refactor/statement/match_statement.py create mode 100644 tests/cases/source/statement/match_statement.py 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 = ''