CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-chex

Comprehensive utilities library for JAX testing, debugging, and instrumentation

73

1.92x
Overview
Eval results
Files

task.mdevals/scenario-4/

Nested Model Comparison Validator

A validation utility for comparing nested model configurations and providing detailed diagnostic feedback. The tool should help developers identify mismatches in complex hierarchical data structures with precise location information.

Capabilities

Compare Nested Structures

  • When comparing two simple dictionaries with matching structures (e.g., {'a': 1, 'b': 2} and {'a': 1, 'b': 2}), validation passes without errors @test
  • When comparing two simple dictionaries with mismatched values (e.g., {'a': 1, 'b': 2} and {'a': 1, 'b': 3}), an error is raised that includes the path to the mismatch (specifically 'b') @test
  • When comparing two nested dictionaries with matching structures (e.g., {'model': {'layers': 3, 'units': 64}} and {'model': {'layers': 3, 'units': 64}}), validation passes without errors @test
  • When comparing two deeply nested dictionaries with a mismatch in the innermost value (e.g., {'model': {'config': {'optimizer': {'lr': 0.01}}}} differs from {'model': {'config': {'optimizer': {'lr': 0.001}}}}), an error is raised showing the complete path to the mismatch (specifically 'model.config.optimizer.lr' or similar representation) @test

Compare Lists Within Structures

  • When comparing structures containing lists with matching values (e.g., {'weights': [1.0, 2.0, 3.0]} and {'weights': [1.0, 2.0, 3.0]}), validation passes @test
  • When comparing structures containing lists with different values at a specific index (e.g., {'weights': [1.0, 2.0, 3.0]} and {'weights': [1.0, 5.0, 3.0]}), an error is raised showing the path including the list index (specifically identifying index 1 within 'weights') @test

Compare Complex Heterogeneous Trees

  • When comparing structures mixing dictionaries, lists, and tuples with all matching values (e.g., {'data': [1, 2], 'meta': (3, 4)} and {'data': [1, 2], 'meta': (3, 4)}), validation passes @test
  • When comparing complex mixed structures with a mismatch in a tuple nested within a list inside a dictionary (e.g., {'items': [{'coords': (1, 2)}, {'coords': (3, 4)}]} differs from {'items': [{'coords': (1, 2)}, {'coords': (3, 5)}]}), an error is raised with a path showing the complete location (e.g., 'items[1].coords[1]' or equivalent representation) @test

Type Mismatch Detection

  • When comparing structures with matching values but different types (e.g., {'value': 42} and {'value': 42.0}), an error is raised indicating both the type mismatch and its location @test

Implementation

@generates

API

def validate_structure_match(expected, actual):
    """
    Compares two nested data structures for equality.

    Validates that two potentially nested structures (dictionaries, lists, tuples)
    have matching values and types throughout. Raises an informative error with
    the path to any mismatch.

    Args:
        expected: The reference structure to compare against
        actual: The structure to validate

    Raises:
        AssertionError: If structures don't match, with a message indicating
                       the path to the mismatch
    """
    pass

Dependencies { .dependencies }

chex { .dependency }

Provides JAX testing utilities with tree comparison and path-based error reporting.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-chex

tile.json