MCPcopy Create free account
hub / github.com/apple/axlearn / test_initialization

Method test_initialization

axlearn/common/segment_tree_test.py:15–21  ·  view source on GitHub ↗

Test that segment tree initializes correctly.

(self)

Source from the content-addressed store, hash-verified

13 """Test cases for the generic SegmentTree data structure."""
14
15 def test_initialization(self):
16 """Test that segment tree initializes correctly."""
17 tree = SegmentTree[int](max_index=5, operation=max, default_value=0)
18 # All values should be default initially
19 for i in range(6):
20 self.assertEqual(tree.get_value(i), 0)
21 self.assertEqual(tree.query_range(0, 5), 0)
22
23 def test_single_update_and_query(self):
24 """Test single updates and point queries."""

Callers

nothing calls this directly

Calls 2

get_valueMethod · 0.80
query_rangeMethod · 0.80

Tested by

no test coverage detected