Skip to content

Commit

Permalink
fix: unnecesary str -> Path conversion in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
desilinguist committed Jul 17, 2023
1 parent 955054f commit b10ce39
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,27 @@ def test_locate_file_valid_paths1(self):
"""Test that `config.locate_file` works with absolute paths."""
config_abs_path = config_dir / "test_config_parsing_relative_path1.cfg"
open(config_abs_path, "w").close()
computed_path = locate_file(config_abs_path, tests_dir)
expected_path = str(config_dir / "test_config_parsing_relative_path1.cfg")
self.assertEqual(Path(computed_path).resolve(), Path(expected_path).resolve())
computed_path = Path(locate_file(config_abs_path, tests_dir))
expected_path = config_dir / "test_config_parsing_relative_path1.cfg"
self.assertEqual(computed_path.resolve(), expected_path.resolve())

def test_locate_file_valid_paths2(self):
"""Test that `config.locate_file` works with relative paths."""
config_abs_path = config_dir / "test_config_parsing_relative_path2.cfg"
config_rel_path = "configs/test_config_parsing_relative_path2.cfg"
open(config_abs_path, "w").close()
computed_path = locate_file(config_rel_path, tests_dir)
expected_path = str(config_abs_path)
self.assertEqual(Path(computed_path).resolve(), Path(expected_path).resolve())
computed_path = Path(locate_file(config_rel_path, tests_dir))
expected_path = config_abs_path
self.assertEqual(computed_path.resolve(), expected_path.resolve())

def test_locate_file_valid_paths3(self):
"""Test that `config.locate_file` works with relative/absolute paths."""
config_abs_path = config_dir / "test_config_parsing_relative_path3.cfg"
config_rel_path = "configs/test_config_parsing_relative_path3.cfg"
open(config_abs_path, "w").close()
computed_path = locate_file(config_abs_path, tests_dir)
expected_path = locate_file(config_rel_path, tests_dir)
self.assertEqual(Path(computed_path).resolve(), Path(expected_path).resolve())
computed_path = Path(locate_file(config_abs_path, tests_dir))
expected_path = Path(locate_file(config_rel_path, tests_dir))
self.assertEqual(computed_path.resolve(), expected_path.resolve())

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

0 comments on commit b10ce39

Please sign in to comment.