@@ -33,9 +33,9 @@ def create_snapshot(elements: list[Element]) -> Snapshot:
3333def test_importance_score_normalization_basic ():
3434 """Test basic importance score normalization to [0, 1] range."""
3535 elements = [
36- create_element (1 , importance = 0 ), # Min -> 0.0
36+ create_element (1 , importance = 0 ), # Min -> 0.0
3737 create_element (2 , importance = 500 ), # Mid -> 0.5
38- create_element (3 , importance = 1000 ), # Max -> 1.0
38+ create_element (3 , importance = 1000 ), # Max -> 1.0
3939 ]
4040 snapshot = create_snapshot (elements )
4141
@@ -52,16 +52,16 @@ def test_importance_score_normalization_basic():
5252 assert "importance_score" in el2
5353 assert "importance_score" in el3
5454
55- assert el1 ["importance_score" ] == 0.0 # (0 - 0) / (1000 - 0) = 0.0
56- assert el2 ["importance_score" ] == 0.5 # (500 - 0) / (1000 - 0) = 0.5
57- assert el3 ["importance_score" ] == 1.0 # (1000 - 0) / (1000 - 0) = 1.0
55+ assert el1 ["importance_score" ] == 0.0 # (0 - 0) / (1000 - 0) = 0.0
56+ assert el2 ["importance_score" ] == 0.5 # (500 - 0) / (1000 - 0) = 0.5
57+ assert el3 ["importance_score" ] == 1.0 # (1000 - 0) / (1000 - 0) = 1.0
5858
5959
6060def test_importance_score_with_negative_values ():
6161 """Test normalization with negative importance values."""
6262 elements = [
6363 create_element (1 , importance = - 300 ), # Min -> 0.0
64- create_element (2 , importance = 500 ), # Mid -> ~0.44
64+ create_element (2 , importance = 500 ), # Mid -> ~0.44
6565 create_element (3 , importance = 1800 ), # Max -> 1.0
6666 ]
6767 snapshot = create_snapshot (elements )
@@ -137,10 +137,7 @@ def test_importance_score_preserves_original_importance():
137137def test_importance_score_in_range_0_to_1 ():
138138 """Test that all normalized scores are in [0, 1] range."""
139139 # Create elements with various importance values
140- elements = [
141- create_element (i , importance = i * 100 - 300 )
142- for i in range (20 )
143- ]
140+ elements = [create_element (i , importance = i * 100 - 300 ) for i in range (20 )]
144141 snapshot = create_snapshot (elements )
145142
146143 event_data = TraceEventBuilder .build_snapshot_event (snapshot )
0 commit comments