kennknowles commented on code in PR #34390:
URL: https://github.com/apache/beam/pull/34390#discussion_r2014742508


##########
sdks/python/apache_beam/io/textio_test.py:
##########
@@ -1442,6 +1461,18 @@ def 
test_read_escaped_escapechar_after_splitting_many(self):
     source_test_utils.assert_sources_equal_reference_source(
         reference_source_info, sources_info)
 
+  def test_read_from_text_dirname_error(self):
+    file_pattern = 'abcd_test'
+    expected_error_message = (
+        "Path type should be local path or GCS path "
+        "when calling ReadFromText")
+
+    with unittest.mock.patch('os.path.dirname') as mock_dirname:
+      mock_dirname.side_effect = TypeError(expected_error_message)

Review Comment:
   Is it possible to actually cause this error, instead? This makes the test 
possibly masking things if the presumed behavior of `os.path.dirname` is not 
quite right, or if it changes.



##########
sdks/python/apache_beam/io/textio_test.py:
##########
@@ -1442,6 +1461,18 @@ def 
test_read_escaped_escapechar_after_splitting_many(self):
     source_test_utils.assert_sources_equal_reference_source(
         reference_source_info, sources_info)
 
+  def test_read_from_text_dirname_error(self):
+    file_pattern = 'abcd_test'
+    expected_error_message = (
+        "Path type should be local path or GCS path "
+        "when calling ReadFromText")
+
+    with unittest.mock.patch('os.path.dirname') as mock_dirname:
+      mock_dirname.side_effect = TypeError(expected_error_message)

Review Comment:
   Is it possible to actually cause this error, instead? Mocking makes the test 
possibly masking things if the presumed behavior of `os.path.dirname` is not 
quite right, or if it changes.



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to