hequn8128 commented on a change in pull request #13117:
URL: https://github.com/apache/flink/pull/13117#discussion_r468962114
##########
File path:
flink-python/pyflink/datastream/tests/test_stream_execution_environment.py
##########
@@ -254,3 +254,20 @@ def test_add_custom_source(self):
results.sort()
expected.sort()
self.assertEqual(expected, results)
+
+ def test_read_text_file(self):
+ texts = ["Mike", "Marry", "Ted", "Jack", "Bob", "Henry"]
+ text_file_path = self.tempdir + '/text_file'
+ with open(text_file_path, 'a') as f:
+ for text in texts:
+ f.write(text)
+ f.write('\n')
+
+ ds = self.env.read_text_file(text_file_path)
+ test_sink = DataStreamTestSinkFunction()
+ ds.add_sink(test_sink)
+ self.env.execute("test read text file")
+ results = test_sink.get_results()
+ results.sort()
+ texts.sort()
+ self.assertEqual(texts, results)
Review comment:
Maybe we can extract an assertEqualWithSort() method and reuse the
method across all tests. We can improve this in a separate PR.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]