shuiqiangchen commented on a change in pull request #13572:
URL: https://github.com/apache/flink/pull/13572#discussion_r503749442



##########
File path: 
flink-python/pyflink/datastream/tests/test_stream_execution_environment.py
##########
@@ -226,50 +227,55 @@ def test_execute(self):
         self.assertIsNotNone(str(execution_result))
 
     def test_from_collection_without_data_types(self):
-        ds = self.env.from_collection([(1, 'Hi', 'Hello', datetime.date(2014, 
9, 13),
-                                        datetime.time(hour=11, minute=0, 
second=0,
-                                                      microsecond=123000),
-                                        datetime.datetime(2018, 3, 11, 3, 0, 
0, 123000)),
-                                       (2, 'Hello', 'Hi', datetime.date(2015, 
10, 14),
-                                        datetime.time(hour=12, minute=0, 
second=0,
-                                                      microsecond=234000),
-                                        datetime.datetime(2019, 4, 12, 4, 1, 
1, 234000))])
+        ds = self.env.from_collection([(1, 'Hi', 'Hello'), (2, 'Hello', 'Hi')])
         ds.add_sink(self.test_sink)
         self.env.execute("test from collection")
         results = self.test_sink.get_results(True)
         # user does not specify data types for input data, the collected 
result should be in
         # in tuple format as inputs.
-        expected = ["(1, 'Hi', 'Hello', datetime.date(2014, 9, 13), "
-                    "datetime.time(11, 0, 0, 123000), "
-                    "datetime.datetime(2018, 3, 11, 3, 0, 0, 123000))",
-                    "(2, 'Hello', 'Hi', datetime.date(2015, 10, 14), "
-                    "datetime.time(12, 0, 0, 234000), "
-                    "datetime.datetime(2019, 4, 12, 4, 1, 1, 234000))"]
+        expected = ["(1, 'Hi', 'Hello')", "(2, 'Hello', 'Hi')"]
         results.sort()
         expected.sort()
         self.assertEqual(expected, results)
 
     def test_from_collection_with_data_types(self):
-        ds = self.env.from_collection([(1, 'Hi', 'Hello', datetime.date(2014, 
9, 13),
-                                        datetime.time(hour=11, minute=0, 
second=0,
-                                                      microsecond=123000),
-                                        datetime.datetime(2018, 3, 11, 3, 0, 
0, 123000)),
-                                       (2, 'Hello', 'Hi', datetime.date(2015, 
10, 14),
-                                        datetime.time(hour=12, minute=0, 
second=0,
-                                                      microsecond=234000),
-                                        datetime.datetime(2019, 4, 12, 4, 1, 
1, 234000))],
-                                      type_info=Types.ROW([Types.INT(),
-                                                           Types.STRING(),
-                                                           Types.STRING(),
-                                                           Types.SQL_DATE(),
-                                                           Types.SQL_TIME(),
-                                                           
Types.SQL_TIMESTAMP()]))
+        # verify from_collection for the collection with single object.
+        ds = self.env.from_collection(['Hi', 'Hello'], 
type_info=Types.STRING())
         ds.add_sink(self.test_sink)
-        self.env.execute("test from collection")
+        self.env.execute("test from collection with single object")
+        results = self.test_sink.get_results(False)
+        expected = ['Hello', 'Hi']
+        results.sort()
+        expected.sort()
+        self.assertEqual(expected, results)
+
+        # verify from_collection for the collection with multiple objects like 
tuple.
+        ds = self.env.from_collection([(1, None, 1, True, 32767, -2147483648, 
1.23, 1.98932,

Review comment:
       The test looks good. Here all input elements are wrapped by rows, what 
if they were basic types? Such as self.env.from_collection([1,2,3], 
type_info=Types.INT()), or self.env.from_collection(["hello", "python", 
"flink"], type_info=Types.STRING()), it would be better to cover this scene. 




----------------------------------------------------------------
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]


Reply via email to