Skip to content

Commit

Permalink
#i313 Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hakancelikdev committed Jun 11, 2024
1 parent 563fb26 commit 019a4ab
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lint:

.PHONY: test
test:
source venv/bin/activate; pytest tests -x -v --disable-warnings
source venv/bin/activate; pytest tests -x -v --disable-warnings -vv

.PHONY: tox
tox:
Expand Down
20 changes: 20 additions & 0 deletions tests/cases/analyzer/if_dispatch/case_7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from typing import List, Union

from unimport.statement import Import, ImportFrom, Name

__all__ = ["NAMES", "IMPORTS", "UNUSED_IMPORTS"]


NAMES: List[Name] = [
Name(lineno=4, name="t.TYPE_CHECKING", is_all=False),
Name(lineno=8, name="QtCore.QThread", is_all=False),
]
IMPORTS: List[Union[Import, ImportFrom]] = [
ImportFrom(lineno=1, column=1, name="QtCore", package="qtpy", star=False, suggestions=[]),
Import(lineno=2, column=1, name="t", package="typing"),
ImportFrom(lineno=5, column=1, name="QtCore", package="PySide6", star=False, suggestions=[]),
]
UNUSED_IMPORTS: List[Union[Import, ImportFrom]] = [
Import(lineno=2, column=1, name="t", package="typing"),
ImportFrom(lineno=5, column=1, name="QtCore", package="PySide6", star=False, suggestions=[]),
]
4 changes: 4 additions & 0 deletions tests/cases/refactor/if_dispatch/case_7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from qtpy import QtCore

class MyThread(QtCore.QThread):
pass
9 changes: 9 additions & 0 deletions tests/cases/source/if_dispatch/case_7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from qtpy import QtCore
import typing as t

if t.TYPE_CHECKING:
from PySide6 import QtCore


class MyThread(QtCore.QThread):
pass

0 comments on commit 019a4ab

Please sign in to comment.