Rename Project Euler directories and other dependent changes (#3300)

* Rename all Project Euler directories:

Reason:
The change was done to maintain consistency throughout the directory
and to keep all directories in sorted order.

Due to the above change, some config files had to be modified:
'problem_22` -> `problem_022`

* Update scripts to pad zeroes in PE directories
This commit is contained in:
Dhruv
2020-10-15 12:43:28 +05:30
committed by GitHub
parent 2d7e08ef83
commit 44254cf112
177 changed files with 108 additions and 112 deletions

View File

@ -37,19 +37,15 @@ def collect_solution_file_paths() -> List[pathlib.Path]:
return solution_file_paths
def expand_parameters(param: pathlib.Path) -> str:
"""Expand parameters in pytest parametrize"""
project_dirname = param.parent.name
solution_filename = param.name
return f"{project_dirname}/{solution_filename}"
@pytest.mark.parametrize(
"solution_path", collect_solution_file_paths(), ids=expand_parameters
"solution_path",
collect_solution_file_paths(),
ids=lambda path: f"{path.parent.name}/{path.name}",
)
def test_project_euler(solution_path: pathlib.Path):
"""Testing for all Project Euler solutions"""
problem_number: str = solution_path.parent.name[8:] # problem_[extract his part]
# problem_[extract this part] and pad it with zeroes for width 3
problem_number: str = solution_path.parent.name[8:].zfill(3)
expected: str = PROBLEM_ANSWERS[problem_number]
solution_module = convert_path_to_module(solution_path)
answer = str(solution_module.solution())