pelicun.tests.basic.test_dlml
These are unit tests on the dlml module of pelicun.
Functions
Mocks the common environment for a data download test. |
|
Test check_dlml_data handles download failures appropriately. |
|
Test check_dlml_data handles permission errors appropriately. |
|
Test check_dlml_data handles version check failures gracefully. |
|
Test check_dlml_data with existing data and no update available. |
|
Test check_dlml_data with existing data and update available. |
|
Test check_dlml_data downloads data when missing. |
|
Test check_dlml_version correctly compares semantic versions. |
|
Test check_dlml_version returns cached result when within 24 hours. |
|
Test check_dlml_version handles commit-based versions. |
|
Test check_dlml_version performs new check when cache is expired. |
|
Test check_dlml_version handles network errors gracefully. |
|
Integration test: CLI with invalid action (not 'update'). |
|
Integration test: CLI with insufficient arguments. |
|
Test handling when GitHub API returns empty commits list. |
|
Test handling of invalid versions or commits. |
|
Test handling when release data doesn't contain target_commitish. |
|
Test handling when model_files.txt doesn't exist after download. |
|
Test handling of general file reading exceptions. |
|
Test handling of network errors during API calls. |
|
Test downloading with caching enabled. |
|
Test downloading with a specific commit. |
|
Test downloading with the 'latest' commit. |
|
Test downloading with a specific version. |
|
Test handling of download failures. |
|
Test downloading a file from a valid URL. |
|
Test that download_data_files stores commit metadata in cache. |
|
Test that download_data_files stores version metadata in cache. |
|
Test hash calculation for files with different content. |
|
Test hash calculation for empty files. |
|
Test hash calculation for existing files. |
|
Test hash calculation for non-existent files. |
|
Test loading from a corrupted cache file. |
|
Test loading from a non-existent cache file. |
|
Test loading from a valid cache file. |
|
Test successful commit-based download via dlml_update() function. |
|
Test dlml_update() function with commit and no cache. |
|
Test dlml_update() function with default 'latest' version when no version specified. |
|
Test error handling when download_data_files raises exceptions via dlml_update() function. |
|
Test no-cache functionality via dlml_update() function. |
|
Test successful version-based download via dlml_update() function. |
|
Test progress bar initialization with different file counts. |
|
|
Test progress bar updates during downloads. |
Test progress reporting for skipped files. |
|
Test saving cache data to a file. |
|
Test validation of invalid commit SHA. |
|
Test validation of the special 'latest' value. |
|
Test validation of valid 7-character commit SHA. |
- pelicun.tests.basic.test_dlml.mock_download_env() Generator[dict[str, Any], None, None] [source]
Mocks the common environment for a data download test.
- pelicun.tests.basic.test_dlml.test_check_dlml_data_download_failure() None [source]
Test check_dlml_data handles download failures appropriately.
- pelicun.tests.basic.test_dlml.test_check_dlml_data_permission_error() None [source]
Test check_dlml_data handles permission errors appropriately.
- pelicun.tests.basic.test_dlml.test_check_dlml_data_version_check_failure() None [source]
Test check_dlml_data handles version check failures gracefully.
- pelicun.tests.basic.test_dlml.test_check_dlml_data_with_existing_data_no_update() None [source]
Test check_dlml_data with existing data and no update available.
- pelicun.tests.basic.test_dlml.test_check_dlml_data_with_existing_data_update_available() None [source]
Test check_dlml_data with existing data and update available.
- pelicun.tests.basic.test_dlml.test_check_dlml_data_with_missing_data() None [source]
Test check_dlml_data downloads data when missing.
- pelicun.tests.basic.test_dlml.test_check_dlml_version_semantic_version_comparison() None [source]
Test check_dlml_version correctly compares semantic versions.
- pelicun.tests.basic.test_dlml.test_check_dlml_version_with_cached_result() None [source]
Test check_dlml_version returns cached result when within 24 hours.
- pelicun.tests.basic.test_dlml.test_check_dlml_version_with_commit_based_version() None [source]
Test check_dlml_version handles commit-based versions.
- pelicun.tests.basic.test_dlml.test_check_dlml_version_with_expired_cache() None [source]
Test check_dlml_version performs new check when cache is expired.
- pelicun.tests.basic.test_dlml.test_check_dlml_version_with_network_error() None [source]
Test check_dlml_version handles network errors gracefully.
- pelicun.tests.basic.test_dlml.test_cli_integration_invalid_action() None [source]
Integration test: CLI with invalid action (not ‘update’).
- pelicun.tests.basic.test_dlml.test_cli_integration_missing_arguments() None [source]
Integration test: CLI with insufficient arguments.
- pelicun.tests.basic.test_dlml.test_download_data_files_empty_repository() None [source]
Test handling when GitHub API returns empty commits list.
- pelicun.tests.basic.test_dlml.test_download_data_files_invalid_commit() None [source]
Test handling of invalid versions or commits.
- pelicun.tests.basic.test_dlml.test_download_data_files_missing_commit_sha_in_release() None [source]
Test handling when release data doesn’t contain target_commitish.
- pelicun.tests.basic.test_dlml.test_download_data_files_model_file_not_found() None [source]
Test handling when model_files.txt doesn’t exist after download.
- pelicun.tests.basic.test_dlml.test_download_data_files_model_file_read_error() None [source]
Test handling of general file reading exceptions.
- pelicun.tests.basic.test_dlml.test_download_data_files_network_error() None [source]
Test handling of network errors during API calls.
- pelicun.tests.basic.test_dlml.test_download_data_files_with_cache(mock_download_env: dict[str, Any]) None [source]
Test downloading with caching enabled.
- pelicun.tests.basic.test_dlml.test_download_data_files_with_commit(mock_download_env: dict[str, Any]) None [source]
Test downloading with a specific commit.
- pelicun.tests.basic.test_dlml.test_download_data_files_with_latest_commit(mock_download_env: dict[str, Any]) None [source]
Test downloading with the ‘latest’ commit.
- pelicun.tests.basic.test_dlml.test_download_data_files_with_version(mock_download_env: dict[str, Any]) None [source]
Test downloading with a specific version.
- pelicun.tests.basic.test_dlml.test_download_file_request_exception() None [source]
Test handling of download failures.
- pelicun.tests.basic.test_dlml.test_download_file_success() None [source]
Test downloading a file from a valid URL.
- pelicun.tests.basic.test_dlml.test_enhanced_cache_with_commit_metadata(mock_download_env: dict[str, Any]) None [source]
Test that download_data_files stores commit metadata in cache.
- pelicun.tests.basic.test_dlml.test_enhanced_cache_with_version_metadata(mock_download_env: dict[str, Any]) None [source]
Test that download_data_files stores version metadata in cache.
- pelicun.tests.basic.test_dlml.test_get_file_hash_different_content() None [source]
Test hash calculation for files with different content.
- pelicun.tests.basic.test_dlml.test_get_file_hash_empty_file() None [source]
Test hash calculation for empty files.
- pelicun.tests.basic.test_dlml.test_get_file_hash_existing_file() None [source]
Test hash calculation for existing files.
- pelicun.tests.basic.test_dlml.test_get_file_hash_nonexistent_file() None [source]
Test hash calculation for non-existent files.
- pelicun.tests.basic.test_dlml.test_load_cache_corrupted_file() None [source]
Test loading from a corrupted cache file.
- pelicun.tests.basic.test_dlml.test_load_cache_nonexistent_file() None [source]
Test loading from a non-existent cache file.
- pelicun.tests.basic.test_dlml.test_load_cache_valid_file() None [source]
Test loading from a valid cache file.
- pelicun.tests.basic.test_dlml.test_main_commit_download() None [source]
Test successful commit-based download via dlml_update() function.
- pelicun.tests.basic.test_dlml.test_main_commit_with_no_cache() None [source]
Test dlml_update() function with commit and no cache.
- pelicun.tests.basic.test_dlml.test_main_default_latest_version() None [source]
Test dlml_update() function with default ‘latest’ version when no version specified.
- pelicun.tests.basic.test_dlml.test_main_download_error_handling() None [source]
Test error handling when download_data_files raises exceptions via dlml_update() function.
- pelicun.tests.basic.test_dlml.test_main_no_cache_flag() None [source]
Test no-cache functionality via dlml_update() function.
- pelicun.tests.basic.test_dlml.test_main_version_download() None [source]
Test successful version-based download via dlml_update() function.
- pelicun.tests.basic.test_dlml.test_progress_bar_initialization(mock_download_env: dict[str, Any]) None [source]
Test progress bar initialization with different file counts.
- pelicun.tests.basic.test_dlml.test_progress_bar_updates(mock_download_env: dict[str, Any]) None [source]
Test progress bar updates during downloads.
- pelicun.tests.basic.test_dlml.test_progress_reporting_for_skipped_files(mock_download_env: dict[str, Any]) None [source]
Test progress reporting for skipped files.
- pelicun.tests.basic.test_dlml.test_validate_commit_sha_invalid() None [source]
Test validation of invalid commit SHA.