Skip to content

Commit 0df6496

Browse files
style: sync tests/test_config_and_fixes.py formatting with master
1 parent 4bb8330 commit 0df6496

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

tests/test_config_and_fixes.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def sample_project(tmp_path):
5353
page = tmp_path / "src" / "app" / "page.tsx"
5454
page.parent.mkdir(parents=True, exist_ok=True)
5555
page.write_text(
56-
'import { Button } from "../components/Button";\nexport default function Page() {\n return <Button />;\n}\n'
56+
'import { Button } from "../components/Button";\n'
57+
"export default function Page() {\n"
58+
" return <Button />;\n"
59+
"}\n"
5760
)
5861

5962
deadpage = tmp_path / "src" / "app" / "deadpage" / "page.tsx"
@@ -102,7 +105,12 @@ def test_from_dict_partial(self):
102105
def test_load_from_yml(self, tmp_path):
103106
config_file = tmp_path / ".deadcode.yml"
104107
config_file.write_text(
105-
'ignore:\n - "generated/"\n - "legacy/"\ncategories:\n - unused_export\nfail_threshold: 3\n'
108+
"ignore:\n"
109+
' - "generated/"\n'
110+
' - "legacy/"\n'
111+
"categories:\n"
112+
" - unused_export\n"
113+
"fail_threshold: 3\n"
106114
)
107115
config = DeadCodeConfig.load(tmp_path)
108116
assert config.ignore == ["generated/", "legacy/"]
@@ -234,7 +242,8 @@ def test_component_imported_not_reported(self, tmp_path):
234242
comp.write_text("export function Button() { return <div>Hi</div>; }\n")
235243
app = tmp_path / "src" / "App.tsx"
236244
app.write_text(
237-
'import { Button } from "./Button";\nexport function App() { return <Button />; }\n'
245+
'import { Button } from "./Button";\n'
246+
"export function App() { return <Button />; }\n"
238247
)
239248

240249
scanner = DeadCodeScanner(tmp_path)
@@ -446,7 +455,8 @@ def test_remove_actually_blanks_lines(self, tmp_path):
446455
mod = tmp_path / "src" / "mod.ts"
447456
mod.parent.mkdir(parents=True, exist_ok=True)
448457
mod.write_text(
449-
"export function unusedA() { return 1; }\nexport function unusedB() { return 2; }\n"
458+
"export function unusedA() { return 1; }\n"
459+
"export function unusedB() { return 2; }\n"
450460
)
451461

452462
import unittest.mock
@@ -465,7 +475,8 @@ def test_remove_preserves_used_exports(self, tmp_path):
465475
mod = tmp_path / "src" / "mod.ts"
466476
mod.parent.mkdir(parents=True, exist_ok=True)
467477
mod.write_text(
468-
"export function usedFunc() { return 1; }\nexport function unusedFunc() { return 2; }\n"
478+
"export function usedFunc() { return 1; }\n"
479+
"export function unusedFunc() { return 2; }\n"
469480
)
470481
app = tmp_path / "src" / "app.ts"
471482
app.write_text('import { usedFunc } from "./mod";\nusedFunc();\n')
@@ -669,7 +680,9 @@ def test_css_utility_prefixes_skipped(self, tmp_path):
669680
"""CSS classes with utility prefixes (hover:, focus:, etc.) should be skipped."""
670681
css = tmp_path / "styles.css"
671682
css.write_text(
672-
".hover:bg-red { color: red; }\n.focus:ring { outline: none; }\n.normal-class { color: blue; }\n"
683+
".hover:bg-red { color: red; }\n"
684+
".focus:ring { outline: none; }\n"
685+
".normal-class { color: blue; }\n"
673686
)
674687
# No JSX using any of these
675688

0 commit comments

Comments
 (0)