depyler-core 3.22.0

Core transpilation engine for the Depyler Python-to-Rust transpiler
Documentation
// Generated by: DEPYLER stdlib validation Phase 1
// Module: itertools - Additional iterator functions
// Status: RED phase - Tests written first, implementation pending

use depyler_core::transpile_python_to_rust;

// Note: dropwhile, accumulate, compress were already implemented
// This commit adds 3 NEW functions: zip_longest, filterfalse, starmap

// DEPYLER-STDLIB-ITERTOOLS-ADDITIONAL-001: Zip longest
#[test]
#[ignore = "DEPYLER-STDLIB-ITERTOOLS: Not implemented yet - RED phase"]
fn test_zip_longest() {
    let python = r#"
import itertools

def zip_with_fill(a: list, b: list) -> list:
    return list(itertools.zip_longest(a, b, fillvalue=None))
"#;

    let result = transpile_python_to_rust(python).expect("Transpilation failed");

    // Should zip with fill values for shorter iterator
    assert!(result.contains("zip") && (result.contains("fillvalue") || result.contains("None")));
}

// DEPYLER-STDLIB-ITERTOOLS-ADDITIONAL-002: Filter false
#[test]
#[ignore = "DEPYLER-STDLIB-ITERTOOLS: Not implemented yet - RED phase"]
fn test_filterfalse() {
    let python = r#"
import itertools

def filter_not(items: list, pred) -> list:
    return list(itertools.filterfalse(pred, items))
"#;

    let result = transpile_python_to_rust(python).expect("Transpilation failed");

    // Should filter elements where predicate is false
    assert!(result.contains("filter") && result.contains("!"));
}

// DEPYLER-STDLIB-ITERTOOLS-ADDITIONAL-003: Star map
#[test]
#[ignore = "DEPYLER-STDLIB-ITERTOOLS: Not implemented yet - RED phase"]
fn test_starmap() {
    let python = r#"
import itertools

def apply_pairs(func, pairs: list) -> list:
    return list(itertools.starmap(func, pairs))
"#;

    let result = transpile_python_to_rust(python).expect("Transpilation failed");

    // Should unpack arguments from tuples
    assert!(result.contains("map") && (result.contains("*") || result.contains("unpack")));
}

// Total: 3 NEW itertools functions (dropwhile, accumulate, compress already existed)
// Coverage: zip_longest(), filterfalse(), starmap()