🔍 Code Extractor

function test_full_analyzer

Maturity: 42

Tests the full contract analyzer pipeline by running a dry-run analysis on a limited number of files to verify the system is working correctly.

File:
/tf/active/vicechatdev/contract_validity_analyzer/test_implementation.py
Lines:
154 - 172
Complexity:
simple

Purpose

This function serves as an integration test for the ContractAnalyzer system. It validates that the entire analyzer pipeline (including configuration, file processing, and analysis) is properly set up and functional. It runs in dry-run mode with a maximum of 2 files to quickly verify system health without processing all available contracts. This is useful for smoke testing, CI/CD validation, and troubleshooting setup issues.

Source Code

def test_full_analyzer(config):
    """Test the full analyzer pipeline."""
    print("\nTesting full analyzer pipeline...")
    
    try:
        analyzer = ContractAnalyzer(config)
        
        # Run in dry-run mode to test the pipeline without processing all files
        print("  Running dry-run analysis...")
        results = analyzer.analyze_contracts(dry_run=True, max_files=2)
        
        print(f"✓ Full analyzer pipeline works")
        print(f"  Would process {len(results)} files")
        
        return True
        
    except Exception as e:
        print(f"✗ Full analyzer failed: {e}")
        return False

Parameters

Name Type Default Kind
config - - positional_or_keyword

Parameter Details

config: A Config object containing all necessary configuration settings for the ContractAnalyzer, including paths, API credentials, processing parameters, and other system settings. This should be an instance of the Config class from config.config module.

Return Value

Returns a boolean value: True if the analyzer pipeline successfully completes the dry-run test without errors, False if any exception occurs during testing. The function also prints status messages to stdout indicating success or failure details.

Dependencies

  • pathlib
  • logging
  • tempfile
  • io
  • reportlab

Required Imports

from config.config import Config
from core.analyzer import ContractAnalyzer

Usage Example

from config.config import Config
from pathlib import Path

# Initialize configuration
config = Config()
config.filecloud_url = 'https://your-filecloud-instance.com'
config.filecloud_username = 'your_username'
config.filecloud_password = 'your_password'
config.llm_api_key = 'your_api_key'
config.contracts_path = Path('/path/to/contracts')

# Run the test
success = test_full_analyzer(config)

if success:
    print('Analyzer pipeline is ready')
else:
    print('Analyzer pipeline has issues')

Best Practices

  • Always run this test before processing large batches of contracts to ensure the system is properly configured
  • Use this function as part of CI/CD pipelines to validate deployment configurations
  • The dry_run=True and max_files=2 parameters ensure quick execution without consuming significant API credits or processing time
  • Monitor the printed output for detailed information about what would be processed
  • Ensure the config object is fully initialized with all required credentials and settings before calling this function
  • This function prints to stdout, so capture or redirect output appropriately in automated testing environments

Similar Components

AI-powered semantic similarity - components with related functionality:

  • function main_v22 72.4% similar

    Orchestrates and executes a comprehensive test suite for a Contract Validity Analyzer system, running tests for configuration, FileCloud connection, document processing, LLM client, and full analyzer functionality.

    From: /tf/active/vicechatdev/contract_validity_analyzer/test_implementation.py
  • function test_with_real_documents 63.1% similar

    Tests a contract analyzer system by processing real documents from FileCloud, extracting contract information, and generating analysis reports with performance metrics.

    From: /tf/active/vicechatdev/contract_validity_analyzer/test_real_documents.py
  • function main_v7 61.3% similar

    Main entry point function that orchestrates the contract validity analysis workflow by loading configuration, setting up logging, initializing the analyzer, running analysis, and reporting results.

    From: /tf/active/vicechatdev/contract_validity_analyzer/core/analyzer.py
  • function main_v6 61.1% similar

    Main entry point function for the Contract Validity Analyzer application that orchestrates configuration loading, logging setup, FileCloud connection, and contract analysis execution.

    From: /tf/active/vicechatdev/contract_validity_analyzer/main.py
  • function test_llm_extraction 58.1% similar

    A test function that validates LLM-based contract data extraction by processing a sample contract and verifying the extracted fields against expected values.

    From: /tf/active/vicechatdev/contract_validity_analyzer/test_extractor.py
← Back to Browse