@@ -142,7 +142,7 @@ def test_structured_annotations_api(self):
142142 found_annotations = False
143143 found_variables = set ()
144144
145- # Track variable locations to detect changes (for selective printing)
145+ # Track variable locations to detect changes (for selective printing).
146146 prev_locations = {}
147147
148148 # Test each instruction
@@ -158,11 +158,11 @@ def test_structured_annotations_api(self):
158158 if annotations .GetSize () > 0 :
159159 found_annotations = True
160160
161- # Track current locations and detect changes
161+ # Track current locations and detect changes.
162162 current_locations = {}
163163 should_print = False
164164
165- # Validate each annotation
165+ # Validate each annotation.
166166 for j in range (annotations .GetSize ()):
167167 ann = annotations .GetItemAtIndex (j )
168168 self .assertTrue (ann .IsValid (),
@@ -195,15 +195,15 @@ def test_structured_annotations_api(self):
195195 self .assertTrue (register_kind_obj .IsValid (),
196196 "Missing 'register_kind' field" )
197197
198- # Extract and validate values
198+ # Extract and validate values.
199199 var_name = var_name_obj .GetStringValue (1024 )
200200 location = location_obj .GetStringValue (1024 )
201201 is_live = is_live_obj .GetBooleanValue ()
202202 start_addr = start_addr_obj .GetUnsignedIntegerValue ()
203203 end_addr = end_addr_obj .GetUnsignedIntegerValue ()
204204 register_kind = register_kind_obj .GetUnsignedIntegerValue ()
205205
206- # Validate types and values
206+ # Validate types and values.
207207 self .assertIsInstance (var_name , str , "variable_name should be string" )
208208 self .assertGreater (len (var_name ), 0 , "variable_name should not be empty" )
209209
@@ -219,20 +219,20 @@ def test_structured_annotations_api(self):
219219
220220 self .assertIsInstance (register_kind , int , "register_kind should be integer" )
221221
222- # Check for expected variables in this function
222+ # Check for expected variables in this function.
223223 self .assertIn (var_name , ["argc" , "argv" , "i" ],
224224 f"Unexpected variable name: { var_name } " )
225225
226226 found_variables .add (var_name )
227227
228- # Track current location
228+ # Track current location.
229229 current_locations [var_name ] = location
230230
231- # Detect if this is a new variable or location changed
231+ # Detect if this is a new variable or location changed.
232232 if var_name not in prev_locations or prev_locations [var_name ] != location :
233233 should_print = True
234234
235- # Check optional fields (may or may not be present)
235+ # Check optional fields (may or may not be present).
236236 decl_file_obj = ann .GetValueForKey ("decl_file" )
237237 if decl_file_obj .IsValid ():
238238 decl_file = decl_file_obj .GetStringValue (1024 )
@@ -245,7 +245,7 @@ def test_structured_annotations_api(self):
245245 decl_line = decl_line_obj .GetUnsignedIntegerValue ()
246246 self .assertIsInstance (decl_line , int )
247247
248- # Validate declaration line matches the source code (according to d_original_example.c)
248+ # Validate declaration line matches the source code (according to d_original_example.c).
249249 if var_name == "argc" :
250250 self .assertEqual (decl_line , 3 , "argc should be declared on line 3" )
251251 elif var_name == "argv" :
@@ -258,7 +258,7 @@ def test_structured_annotations_api(self):
258258 type_name = type_name_obj .GetStringValue (1024 )
259259 self .assertIsInstance (type_name , str )
260260
261- # Validate declaration line matches the source code (according to d_original_example.c)
261+ # Validate declaration line matches the source code (according to d_original_example.c).
262262 if var_name == "argc" :
263263 self .assertEqual (type_name , "int" , "argc should be type 'int'" )
264264 elif var_name == "argv" :
@@ -267,19 +267,19 @@ def test_structured_annotations_api(self):
267267 self .assertEqual (type_name , "int" , "i should be type 'int'" )
268268
269269 if self .TraceOn ():
270- # Only print if something happened (location changed or variable appeared/disappeared)
270+ # Only print if something happened (location changed or variable appeared/disappeared).
271271 if should_print or len (current_locations ) != len (prev_locations ):
272272 print (f"\n Instruction { i } at { inst .GetAddress ()} : { annotations .GetSize ()} annotations" )
273273 for var_name , location in current_locations .items ():
274274 change_marker = " <- CHANGED" if var_name in prev_locations and prev_locations [var_name ] != location else ""
275275 new_marker = " <- NEW" if var_name not in prev_locations else ""
276276 print (f" { var_name } = { location } { change_marker } { new_marker } " )
277- # Check for disappeared variables
277+ # Check for disappeared variables.
278278 for var_name in prev_locations :
279279 if var_name not in current_locations :
280280 print (f" { var_name } <- GONE" )
281281
282- # Update tracking
282+ # Update tracking.
283283 prev_locations = current_locations .copy ()
284284
285285 self .assertTrue (found_annotations ,
0 commit comments