@@ -239,26 +239,32 @@ def _records(self, n):
239239 return [{"accountid" : f"id-{ i } " , "name" : f"N{ i } " } for i in range (n )]
240240
241241 def test_one_record_single_request (self ):
242+ """Single record produces one request."""
242243 self .od ._update_multiple ("accounts" , "account" , self ._records (1 ))
243244 self .od ._execute_raw .assert_called_once ()
244245
245246 def test_batch_minus_one_single_request (self ):
247+ """_MULTIPLE_BATCH_SIZE-1 records fit in one chunk."""
246248 self .od ._update_multiple ("accounts" , "account" , self ._records (_MULTIPLE_BATCH_SIZE - 1 ))
247249 self .od ._execute_raw .assert_called_once ()
248250
249251 def test_exact_batch_single_request (self ):
252+ """Exactly _MULTIPLE_BATCH_SIZE records produces one chunk and one request."""
250253 self .od ._update_multiple ("accounts" , "account" , self ._records (_MULTIPLE_BATCH_SIZE ))
251254 self .od ._execute_raw .assert_called_once ()
252255
253256 def test_batch_plus_one_two_requests (self ):
257+ """_MULTIPLE_BATCH_SIZE+1 records produces two chunks and two requests."""
254258 self .od ._update_multiple ("accounts" , "account" , self ._records (_MULTIPLE_BATCH_SIZE + 1 ))
255259 self .assertEqual (self .od ._execute_raw .call_count , 2 )
256260
257261 def test_two_full_batches (self ):
262+ """2*_MULTIPLE_BATCH_SIZE records produces two full chunks."""
258263 self .od ._update_multiple ("accounts" , "account" , self ._records (2 * _MULTIPLE_BATCH_SIZE ))
259264 self .assertEqual (self .od ._execute_raw .call_count , 2 )
260265
261266 def test_two_batches_plus_one (self ):
267+ """2*_MULTIPLE_BATCH_SIZE+1 records produces three chunks."""
262268 self .od ._update_multiple ("accounts" , "account" , self ._records (2 * _MULTIPLE_BATCH_SIZE + 1 ))
263269 self .assertEqual (self .od ._execute_raw .call_count , 3 )
264270
@@ -310,16 +316,19 @@ def setUp(self):
310316 self .od ._execute_raw = MagicMock (return_value = _mock_update_response ())
311317
312318 def test_empty_list_raises_type_error (self ):
319+ """Empty list raises TypeError before any HTTP call."""
313320 with self .assertRaises (TypeError ):
314321 self .od ._update_multiple ("accounts" , "account" , [])
315322 self .od ._execute_raw .assert_not_called ()
316323
317324 def test_non_list_raises_type_error (self ):
325+ """Non-list input raises TypeError before any HTTP call."""
318326 with self .assertRaises (TypeError ):
319327 self .od ._update_multiple ("accounts" , "account" , {"accountid" : "x" }) # type: ignore
320328 self .od ._execute_raw .assert_not_called ()
321329
322330 def test_non_dict_element_raises_type_error (self ):
331+ """A non-dict element raises TypeError before any HTTP call."""
323332 with self .assertRaises (TypeError ):
324333 self .od ._update_multiple ("accounts" , "account" , [{"accountid" : "x" }, "bad" ])
325334 self .od ._execute_raw .assert_not_called ()
@@ -346,29 +355,35 @@ def setUp(self):
346355 self .od ._request .return_value = MagicMock ()
347356
348357 def test_one_record_single_request (self ):
358+ """Single record produces one request."""
349359 self .od ._upsert_multiple ("accounts" , "account" , _alt_keys (1 ), _upsert_records (1 ))
350360 self .od ._request .assert_called_once ()
351361
352362 def test_batch_minus_one_single_request (self ):
363+ """_MULTIPLE_BATCH_SIZE-1 records fit in one chunk."""
353364 n = _MULTIPLE_BATCH_SIZE - 1
354365 self .od ._upsert_multiple ("accounts" , "account" , _alt_keys (n ), _upsert_records (n ))
355366 self .od ._request .assert_called_once ()
356367
357368 def test_exact_batch_single_request (self ):
369+ """Exactly _MULTIPLE_BATCH_SIZE records produces one chunk and one request."""
358370 self .od ._upsert_multiple ("accounts" , "account" , _alt_keys (_MULTIPLE_BATCH_SIZE ), _upsert_records (_MULTIPLE_BATCH_SIZE ))
359371 self .od ._request .assert_called_once ()
360372
361373 def test_batch_plus_one_two_requests (self ):
374+ """_MULTIPLE_BATCH_SIZE+1 records produces two chunks and two requests."""
362375 n = _MULTIPLE_BATCH_SIZE + 1
363376 self .od ._upsert_multiple ("accounts" , "account" , _alt_keys (n ), _upsert_records (n ))
364377 self .assertEqual (self .od ._request .call_count , 2 )
365378
366379 def test_two_full_batches (self ):
380+ """2*_MULTIPLE_BATCH_SIZE records produces two full chunks."""
367381 n = 2 * _MULTIPLE_BATCH_SIZE
368382 self .od ._upsert_multiple ("accounts" , "account" , _alt_keys (n ), _upsert_records (n ))
369383 self .assertEqual (self .od ._request .call_count , 2 )
370384
371385 def test_two_batches_plus_one (self ):
386+ """2*_MULTIPLE_BATCH_SIZE+1 records produces three chunks."""
372387 n = 2 * _MULTIPLE_BATCH_SIZE + 1
373388 self .od ._upsert_multiple ("accounts" , "account" , _alt_keys (n ), _upsert_records (n ))
374389 self .assertEqual (self .od ._request .call_count , 3 )
@@ -436,11 +451,13 @@ def setUp(self):
436451 self .od ._request .return_value = MagicMock ()
437452
438453 def test_length_mismatch_raises_value_error (self ):
454+ """Mismatched alternate_keys and records lengths raise ValueError before any HTTP call."""
439455 with self .assertRaises (ValueError , msg = "alternate_keys and records must have the same length" ):
440456 self .od ._upsert_multiple ("accounts" , "account" , _alt_keys (3 ), _upsert_records (2 ))
441457 self .od ._request .assert_not_called ()
442458
443459 def test_key_conflict_raises_value_error (self ):
460+ """Conflicting value for a key field in the record payload raises ValueError before any HTTP call."""
444461 with self .assertRaises (ValueError , msg = "record payload conflicts with alternate_key" ):
445462 self .od ._upsert_multiple (
446463 "accounts" ,
@@ -557,6 +574,7 @@ class TestPublicCreateDelegation(unittest.TestCase):
557574 """records.create delegates to _create_multiple for list input."""
558575
559576 def test_list_delegates_to_create_multiple (self ):
577+ """List input routes to _create_multiple, not _create."""
560578 ops , mock_odata = _make_records_client ()
561579 ops .create ("account" , [{"name" : "A" }, {"name" : "B" }])
562580 mock_odata ._create_multiple .assert_called_once_with (
@@ -576,6 +594,7 @@ class TestPublicUpdateDelegation(unittest.TestCase):
576594 """records.update delegates to _update_by_ids for list input."""
577595
578596 def test_list_delegates_to_update_by_ids (self ):
597+ """Broadcast list input routes to _update_by_ids, not _update."""
579598 ops , mock_odata = _make_records_client ()
580599 ops .update ("account" , ["id-1" , "id-2" ], {"name" : "X" })
581600 mock_odata ._update_by_ids .assert_called_once_with (
0 commit comments