Download data/tests/test_cli_copy.py from introvoyz042/haddock3: direct link, hf CLI and curl.
- Browser
- Download file 930 Bytes
-
https://huggingface.co/datasets/introvoyz042/haddock3/resolve/main/data/tests/test_cli_copy.py
- Command line
-
hf download hf://datasets/introvoyz042/haddock3/data/tests/test_cli_copy.py
-
curl -L -o test_cli_copy.py https://huggingface.co/datasets/introvoyz042/haddock3/resolve/main/data/tests/test_cli_copy.py
930 Bytes
| """Test client copy.""" | |
| import shutil | |
| from pathlib import Path | |
| from haddock.clis.cli_cp import main | |
| from . import tests_path | |
| def test_main(): | |
| """Test main function of haddock3-copy CLI.""" | |
| run1 = Path(tests_path, "clis", "hd3_copy", "run1") | |
| run2 = Path(tests_path, "clis", "hd3_copy", "run2") | |
| run2_ref = Path(tests_path, "clis", "hd3_copy", "run2_ref") | |
| main(run1, [0, 2, 3], run2) | |
| compare_files(run2, run2_ref) | |
| # easy way to make sure no file is left behind | |
| compare_files(run2_ref, run2) | |
| shutil.rmtree(run2) | |
| def compare_files(folder1, folder2): | |
| for file_folder in folder1.iterdir(): | |
| file_folder_2 = Path(folder2, file_folder.name) | |
| if file_folder.is_file(): | |
| text1 = file_folder.read_text() | |
| text2 = file_folder_2.read_text() | |
| assert text1 == text2 | |
| if file_folder.is_dir(): | |
| compare_files(file_folder, file_folder_2) | |