From 422a9d088b192164cc1158091a80c164b92e4422 Mon Sep 17 00:00:00 2001 From: andrecs <12188364+andrecsilva@users.noreply.github.com> Date: Thu, 26 Oct 2023 08:58:21 -0300 Subject: [PATCH] Added test with __init__.py file for RemoveUnusedImports --- tests/codemods/test_remove_unused_imports.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/codemods/test_remove_unused_imports.py b/tests/codemods/test_remove_unused_imports.py index 1498a251..4d4a613d 100644 --- a/tests/codemods/test_remove_unused_imports.py +++ b/tests/codemods/test_remove_unused_imports.py @@ -1,3 +1,4 @@ +from pathlib import Path from core_codemods.remove_unused_imports import RemoveUnusedImports from tests.codemods.base_codemod_test import BaseCodemodTest from textwrap import dedent @@ -113,3 +114,9 @@ def test_dont_remove_if_pylint_disable_next(self, tmpdir): ) self.run_and_assert(tmpdir, before, before) assert len(self.file_context.codemod_changes) == 0 + + def test_ignore_init_files(self, tmpdir): + before = "import a" + tmp_file_path = Path(tmpdir / "__init__.py") + self.run_and_assert_filepath(tmpdir, tmp_file_path, before, before) + assert len(self.file_context.codemod_changes) == 0