Skip to content

Commit

Permalink
added type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
az108 committed Sep 8, 2024
1 parent 413557f commit 6473567
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
import shutil
from logging_config import logging

test_files_folder = "../../../src/main/resources/templates/java/test/testFiles"
default_folder = "./testFiles-template/default"
random_test_case_dest = os.path.join(test_files_folder, "RandomizedTestCases.java")
test_files_folder: str = "../../../src/main/resources/templates/java/test/testFiles"
default_folder: str = "./testFiles-template/default"
random_test_case_dest: str = os.path.join(test_files_folder, "RandomizedTestCases.java")

def delete_random_test_case():
def delete_random_test_case() -> None:
if os.path.exists(random_test_case_dest):
os.remove(random_test_case_dest)
logging.info(f"Deleted file: {random_test_case_dest}")
else:
logging.info(f"RandomizedTestCases.java file not found at {random_test_case_dest}")

def copy_default_folders():
def copy_default_folders() -> None:
for folder_name in os.listdir(default_folder):
src_folder_path = os.path.join(default_folder, folder_name)
dest_folder_path = os.path.join(test_files_folder, folder_name)
src_folder_path: str = os.path.join(default_folder, folder_name)
dest_folder_path: str = os.path.join(test_files_folder, folder_name)
if os.path.isdir(src_folder_path):
shutil.copytree(src_folder_path, dest_folder_path)
logging.info(f"Copied folder {src_folder_path} to {dest_folder_path}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
import shutil
from logging_config import logging

test_files_folder = "../../../src/main/resources/templates/java/test/testFiles"
random_test_case_file = "./testFiles-template/randomized/RandomizedTestCases.java"
random_test_case_dest = os.path.join(test_files_folder, "RandomizedTestCases.java")
test_files_folder: str = "../../../src/main/resources/templates/java/test/testFiles"
random_test_case_file: str = "./testFiles-template/randomized/RandomizedTestCases.java"
random_test_case_dest: str = os.path.join(test_files_folder, "RandomizedTestCases.java")

def delete_existing_folders():
folders_to_delete = ["behavior", "structural"]
def delete_existing_folders() -> None:
folders_to_delete: list[str] = ["behavior", "structural"]
for folder in folders_to_delete:
folder_path = os.path.join(test_files_folder, folder)
folder_path: str = os.path.join(test_files_folder, folder)
if os.path.exists(folder_path) and os.path.isdir(folder_path):
shutil.rmtree(folder_path)
logging.info(f"Deleted folder: {folder_path}")
else:
logging.info(f"Folder not found: {folder_path}")

def copy_random_test_case():
def copy_random_test_case() -> None:
if os.path.exists(random_test_case_file):
shutil.copy(random_test_case_file, random_test_case_dest)
logging.info(f"Copied {random_test_case_file} to {random_test_case_dest}")
Expand Down

0 comments on commit 6473567

Please sign in to comment.