Skip to content

Commit b10ce39

Browse files
committed
fix: unnecesary str -> Path conversion in tests
1 parent 955054f commit b10ce39

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/test_input.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,27 @@ def test_locate_file_valid_paths1(self):
8585
"""Test that `config.locate_file` works with absolute paths."""
8686
config_abs_path = config_dir / "test_config_parsing_relative_path1.cfg"
8787
open(config_abs_path, "w").close()
88-
computed_path = locate_file(config_abs_path, tests_dir)
89-
expected_path = str(config_dir / "test_config_parsing_relative_path1.cfg")
90-
self.assertEqual(Path(computed_path).resolve(), Path(expected_path).resolve())
88+
computed_path = Path(locate_file(config_abs_path, tests_dir))
89+
expected_path = config_dir / "test_config_parsing_relative_path1.cfg"
90+
self.assertEqual(computed_path.resolve(), expected_path.resolve())
9191

9292
def test_locate_file_valid_paths2(self):
9393
"""Test that `config.locate_file` works with relative paths."""
9494
config_abs_path = config_dir / "test_config_parsing_relative_path2.cfg"
9595
config_rel_path = "configs/test_config_parsing_relative_path2.cfg"
9696
open(config_abs_path, "w").close()
97-
computed_path = locate_file(config_rel_path, tests_dir)
98-
expected_path = str(config_abs_path)
99-
self.assertEqual(Path(computed_path).resolve(), Path(expected_path).resolve())
97+
computed_path = Path(locate_file(config_rel_path, tests_dir))
98+
expected_path = config_abs_path
99+
self.assertEqual(computed_path.resolve(), expected_path.resolve())
100100

101101
def test_locate_file_valid_paths3(self):
102102
"""Test that `config.locate_file` works with relative/absolute paths."""
103103
config_abs_path = config_dir / "test_config_parsing_relative_path3.cfg"
104104
config_rel_path = "configs/test_config_parsing_relative_path3.cfg"
105105
open(config_abs_path, "w").close()
106-
computed_path = locate_file(config_abs_path, tests_dir)
107-
expected_path = locate_file(config_rel_path, tests_dir)
108-
self.assertEqual(Path(computed_path).resolve(), Path(expected_path).resolve())
106+
computed_path = Path(locate_file(config_abs_path, tests_dir))
107+
expected_path = Path(locate_file(config_rel_path, tests_dir))
108+
self.assertEqual(computed_path.resolve(), expected_path.resolve())
109109

110110
def test_locate_file_invalid_path(self):
111111
"""Test that `config.locate_file` raises error for paths that do not exist."""

0 commit comments

Comments
 (0)