POMDPPlanners.tests.test_core.test_vectorized_belief_tree package

Tests for POMDPPlanners.core.tree.vectorized_belief_tree.

Submodules

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree module

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree_lookup module

Tests for the pure vectorized lookup and grouping helpers.

These cover the batched primitives underpinning the belief tree — composite-pair matching, pair deduplication, CSR child grouping, boolean scatter-OR, and segmented reductions — in isolation from the tree class.

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree_lookup.test_csr_children_groups_by_parent()[source]

csr_children returns a CSR grouping of nodes by parent.

Purpose: Validates segmented child grouping with offsets.

Given: A parent column assigning four nodes to parents 0, 1, 0, 2 When: csr_children queries parents [0, 1, 2, 3] Then: Offsets delimit each parent’s children and an absent parent is empty

Test type: unit

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree_lookup.test_match_pairs_finds_existing_and_marks_missing()[source]

Composite-pair matching returns existing indices and -1 for misses.

Purpose: Validates that match_pairs resolves query pairs against existing

pairs while preserving batch order.

Given: Two existing (first, second) pairs and a query batch mixing a hit,

a miss, and a repeated hit

When: match_pairs is called Then: Matching queries return the existing index and misses return -1, in

input order

Test type: unit

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree_lookup.test_match_pairs_with_no_existing_returns_all_missing()[source]

match_pairs against an empty existing set returns all -1.

Purpose: Validates the empty-tree lookup path.

Given: No existing pairs and a non-empty query batch When: match_pairs is called Then: Every query resolves to -1

Test type: unit

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree_lookup.test_scatter_or_reduces_booleans_by_index()[source]

scatter_or ORs boolean values into their target positions.

Purpose: Validates duplicate-safe boolean scatter used for terminal flags.

Given: Values routed to indices where one target sees both True and False When: scatter_or reduces them into a size-4 tensor Then: A target is True iff any routed value is True; others are False

Test type: unit

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree_lookup.test_segment_reduce_rejects_unknown_reduction()[source]

segment_reduce raises on an unsupported reduction name.

Purpose: Validates input validation of the reduction argument.

Given: A valid segment/value batch When: segment_reduce is called with an unknown reduction name Then: A ValueError is raised

Test type: unit

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree_lookup.test_segment_reduce_supports_sum_mean_max_min()[source]

segment_reduce computes each supported reduction with empty defaults.

Purpose: Validates the generic segmented reduction helper.

Given: Values grouped into segments with one empty segment When: segment_reduce is applied with each supported reduction Then: Non-empty segments reduce correctly and empty segments are 0

Test type: unit

POMDPPlanners.tests.test_core.test_vectorized_belief_tree.test_vectorized_belief_tree_lookup.test_unique_pairs_collapses_duplicates_with_inverse()[source]

unique_pairs deduplicates and returns a reconstructing inverse.

Purpose: Validates deduplication of a pair batch and the inverse mapping.

Given: A batch of pairs with two identical entries When: unique_pairs is called Then: Distinct pairs appear once and the inverse reproduces the input

Test type: unit