gemini-code-assist[bot] commented on code in PR #38748:
URL: https://github.com/apache/beam/pull/38748#discussion_r3327931773


##########
sdks/python/apache_beam/runners/worker/opcounters_test.py:
##########
@@ -184,6 +184,22 @@ def test_update_batch(self):
 
     self.verify_counters(opcounts, 200, size_per_element)
 
+  def test_update_empty_batch(self):
+    opcounts = OperationCounters(
+        CounterFactory(),
+        'some-name',
+        coders.FastPrimitivesCoder(),
+        0,
+        producer_batch_converter=typehints.batch.BatchConverter.from_typehints(
+            element_type=typehints.Any,
+            batch_type=typehints.List[typehints.Any]))
+
+    self.verify_counters(opcounts, 0, float('nan'))
+
+    opcounts.update_from_batch(GlobalWindows.windowed_batch([]))
+
+    self.verify_counters(opcounts, 0, float('nan'))

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `math.nan` is more idiomatic and efficient than calling `float('nan')` 
repeatedly, especially since the `math` module is already imported and used in 
this test file.
   
   ```suggestion
       self.verify_counters(opcounts, 0, math.nan)
   
       opcounts.update_from_batch(GlobalWindows.windowed_batch([]))
   
       self.verify_counters(opcounts, 0, math.nan)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to