Orchestrata Ultimate › Tests › Reference › session › test_kg_sync_coverage

Tests reference — tests/session/test_kg_sync_coverage.py

Module of tests/session, split out because the directory page would be too large.

Prose pending.

tests/session/test_kg_sync_coverage.py

source · 55 tests · 651 lines

Coverage tests for session.kg_sync — pure Python paths.

Covers: session.kg_sync/ (package)

Kind Name Line Description
class TestSyncStatsExtended 40 Extended tests for SyncStats dataclass.
method TestSyncStatsExtended.test_to_dict_rounds_duration 43 Test duration_ms is rounded to 1 decimal.
method TestSyncStatsExtended.test_to_dict_zero_duration 48 Test zero duration serializes correctly.
method TestSyncStatsExtended.test_ok_with_empty_errors_list 53 Test ok is True when errors is explicitly empty.
method TestSyncStatsExtended.test_ok_with_multiple_errors 58 Test ok is False with multiple errors.
method TestSyncStatsExtended.test_mutable_fields_independent 63 Test that two SyncStats share no mutable state.
method TestSyncStatsExtended.test_to_dict_keys 72 Test to_dict returns exactly the expected keys.
class TestModuleConstants 89 Test module-level constants are well-formed.
method TestModuleConstants.test_ignore_dirs_contains_pycache 92 Test IGNORE_DIRS includes pycache.
method TestModuleConstants.test_ignore_dirs_contains_git 96 Test IGNORE_DIRS includes .git.
method TestModuleConstants.test_code_extensions_contains_py 100 Test CODE_EXTENSIONS includes .py.
method TestModuleConstants.test_sync_extensions_superset_of_code 104 Test SYNC_EXTENSIONS is a superset of CODE_EXTENSIONS.
method TestModuleConstants.test_batch_size_is_positive 108 Test BATCH_SIZE is a positive integer.
class TestExtractTraceDecorator 116 Tests for _extract_trace_decorator AST parsing.
method TestExtractTraceDecorator.test_extract_simple_traces 131 Test extracting a simple @traces decorator.
method TestExtractTraceDecorator.test_extract_multiple_reqs 140 Test extracting multiple requirements.
method TestExtractTraceDecorator.test_extract_returns_none_for_non_traces 152 Test non-traces decorator returns None.
method TestExtractTraceDecorator.test_extract_empty_reqs_returns_none 165 Test decorator with empty reqs list returns None.
method TestExtractTraceDecorator.test_extract_no_spec_keyword 172 Test decorator with reqs but no spec keyword.
method TestExtractTraceDecorator.test_extract_attribute_style_traces 181 Test module.traces style decorator.
class TestDecoratorName 202 Tests for _decorator_name AST helper.
method TestDecoratorName.test_name_decorator 205 Test extracting name from a simple decorator.
method TestDecoratorName.test_attribute_decorator 214 Test extracting name from attribute-style decorator.
method TestDecoratorName.test_call_decorator 223 Test extracting name from call-style decorator.
method TestDecoratorName.test_unknown_node_type_returns_empty 232 Test that unknown AST node type returns empty string.
class TestIsTopLevel 241 Tests for _is_top_level AST helper.
method TestIsTopLevel.test_top_level_function 244 Test that a top-level function is detected.
method TestIsTopLevel.test_nested_function_not_top_level 251 Test that a class method is not top-level.
class TestCollectFileBatch 265 Tests for _collect_file_batch (file scanning).
method TestCollectFileBatch.test_empty_dir 268 Test empty directory yields empty batch.
method TestCollectFileBatch.test_py_file_included 273 Test .py files are included in batch.
method TestCollectFileBatch.test_unsupported_extension_excluded 283 Test unsupported extensions are excluded.
method TestCollectFileBatch.test_file_hash_computed 291 Test file hash is a 16-char hex string.
method TestCollectFileBatch.test_file_hash_matches_sha256 302 Test hash matches manual SHA-256 computation.
method TestCollectFileBatch.test_line_count 312 Test line count is computed correctly.
method TestCollectFileBatch.test_ignored_directory_excluded 318 Test files in IGNORE_DIRS are excluded.
method TestCollectFileBatch.test_nested_dir_path 331 Test dir_path is set correctly for nested files.
method TestCollectFileBatch.test_root_level_dir_path 341 Test dir_path is '.' for root-level files.
method TestCollectFileBatch.test_multiple_extensions 349 Test multiple supported extensions are all included.
class TestCollectDirBatch 370 Tests for _collect_dir_batch (directory scanning).
method TestCollectDirBatch.test_empty_dir_returns_root_only 373 Test empty directory returns only the root entry.
method TestCollectDirBatch.test_subdirectory_included 380 Test subdirectories are included.
method TestCollectDirBatch.test_nested_parent_path 390 Test parent_path is set correctly for nested dirs.
method TestCollectDirBatch.test_ignored_dir_excluded 399 Test IGNORE_DIRS are excluded from batch.
class TestCollectModulePaths 414 Tests for _collect_module_paths (Python package detection).
method TestCollectModulePaths.test_no_packages 417 Test directory with no init.py files.
method TestCollectModulePaths.test_detects_package 422 Test directory with init.py is detected as package.
method TestCollectModulePaths.test_nested_packages 433 Test nested packages are all detected.
class TestCodeParseFiles 450 Tests for _code_parse_files AST extraction.
method TestCodeParseFiles.test_parse_class 453 Test parsing a file with a class definition.
method TestCodeParseFiles.test_parse_function 466 Test parsing a file with a top-level function.
method TestCodeParseFiles.test_parse_class_with_methods 479 Test parsing a class with methods.
method TestCodeParseFiles.test_parse_traced_class 504 Test parsing a class with @traces decorator.
method TestCodeParseFiles.test_skips_up_to_date_files 526 Test files in up_to_date set are skipped.
method TestCodeParseFiles.test_syntax_error_recorded 539 Test that syntax errors are recorded in stats.
method TestCodeParseFiles.test_parse_no_docstring 549 Test parsing class without docstring.
class TestCodeCollectPyFiles 567 Tests for _code_collect_py_files helper.
method TestCodeCollectPyFiles.test_explicit_files 570 Test passing explicit file list.
method TestCodeCollectPyFiles.test_auto_discover 576 Test auto-discovery of .py files.
method TestCodeCollectPyFiles.test_auto_discover_ignores_pycache 587 Test auto-discovery skips pycache.
class TestLatestModifiedFileEdgeCases 604 Edge case tests for latest_modified_file.
method TestLatestModifiedFileEdgeCases.test_all_ignored_dirs 607 Test directory containing only ignored directories.
method TestLatestModifiedFileEdgeCases.test_deeply_nested_file 617 Test finding file deep in directory tree.
method TestLatestModifiedFileEdgeCases.test_symlink_to_file 626 Test handling of symlinked files.
class TestConnectedProperty 640 Tests for connected property.
method TestConnectedProperty.test_not_connected_by_default 643 Test syncer is not connected after init.
method TestConnectedProperty.test_close_idempotent 647 Test closing twice does not raise.