pelicun.tests.basic.test_dlml

These are unit tests on the dlml module of pelicun.

Functions

mock_download_env()

Mocks the common environment for a data download test.

test_check_dlml_data_download_failure()

Test check_dlml_data handles download failures appropriately.

test_check_dlml_data_permission_error()

Test check_dlml_data handles permission errors appropriately.

test_check_dlml_data_version_check_failure()

Test check_dlml_data handles version check failures gracefully.

test_check_dlml_data_with_existing_data_no_update()

Test check_dlml_data with existing data and no update available.

test_check_dlml_data_with_existing_data_update_available()

Test check_dlml_data with existing data and update available.

test_check_dlml_data_with_missing_data()

Test check_dlml_data downloads data when missing.

test_check_dlml_version_semantic_version_comparison()

Test check_dlml_version correctly compares semantic versions.

test_check_dlml_version_with_cached_result()

Test check_dlml_version returns cached result when within 24 hours.

test_check_dlml_version_with_commit_based_version()

Test check_dlml_version handles commit-based versions.

test_check_dlml_version_with_expired_cache()

Test check_dlml_version performs new check when cache is expired.

test_check_dlml_version_with_network_error()

Test check_dlml_version handles network errors gracefully.

test_cli_integration_invalid_action()

Integration test: CLI with invalid action (not 'update').

test_cli_integration_missing_arguments()

Integration test: CLI with insufficient arguments.

test_download_data_files_empty_repository()

Test handling when GitHub API returns empty commits list.

test_download_data_files_invalid_commit()

Test handling of invalid versions or commits.

test_download_data_files_missing_commit_sha_in_release()

Test handling when release data doesn't contain target_commitish.

test_download_data_files_model_file_not_found()

Test handling when model_files.txt doesn't exist after download.

test_download_data_files_model_file_read_error()

Test handling of general file reading exceptions.

test_download_data_files_network_error()

Test handling of network errors during API calls.

test_download_data_files_with_cache(...)

Test downloading with caching enabled.

test_download_data_files_with_commit(...)

Test downloading with a specific commit.

test_download_data_files_with_latest_commit(...)

Test downloading with the 'latest' commit.

test_download_data_files_with_version(...)

Test downloading with a specific version.

test_download_file_request_exception()

Test handling of download failures.

test_download_file_success()

Test downloading a file from a valid URL.

test_enhanced_cache_with_commit_metadata(...)

Test that download_data_files stores commit metadata in cache.

test_enhanced_cache_with_version_metadata(...)

Test that download_data_files stores version metadata in cache.

test_get_file_hash_different_content()

Test hash calculation for files with different content.

test_get_file_hash_empty_file()

Test hash calculation for empty files.

test_get_file_hash_existing_file()

Test hash calculation for existing files.

test_get_file_hash_nonexistent_file()

Test hash calculation for non-existent files.

test_load_cache_corrupted_file()

Test loading from a corrupted cache file.

test_load_cache_nonexistent_file()

Test loading from a non-existent cache file.

test_load_cache_valid_file()

Test loading from a valid cache file.

test_main_commit_download()

Test successful commit-based download via dlml_update() function.

test_main_commit_with_no_cache()

Test dlml_update() function with commit and no cache.

test_main_default_latest_version()

Test dlml_update() function with default 'latest' version when no version specified.

test_main_download_error_handling()

Test error handling when download_data_files raises exceptions via dlml_update() function.

test_main_no_cache_flag()

Test no-cache functionality via dlml_update() function.

test_main_version_download()

Test successful version-based download via dlml_update() function.

test_progress_bar_initialization(...)

Test progress bar initialization with different file counts.

test_progress_bar_updates(mock_download_env)

Test progress bar updates during downloads.

test_progress_reporting_for_skipped_files(...)

Test progress reporting for skipped files.

test_save_cache()

Test saving cache data to a file.

test_validate_commit_sha_invalid()

Test validation of invalid commit SHA.

test_validate_commit_sha_latest()

Test validation of the special 'latest' value.

test_validate_commit_sha_valid()

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_save_cache() None[source]

Test saving cache data to a file.

pelicun.tests.basic.test_dlml.test_validate_commit_sha_invalid() None[source]

Test validation of invalid commit SHA.

pelicun.tests.basic.test_dlml.test_validate_commit_sha_latest() None[source]

Test validation of the special ‘latest’ value.

pelicun.tests.basic.test_dlml.test_validate_commit_sha_valid() None[source]

Test validation of valid 7-character commit SHA.