dianfu commented on a change in pull request #8777: [hotfix][python][test] fix
IDE test problems and unified assertion usage
URL: https://github.com/apache/flink/pull/8777#discussion_r294667984
##########
File path: flink-python/pyflink/table/tests/test_descriptor.py
##########
@@ -80,62 +70,48 @@ def test_properties():
'connector.properties.1.key': 'bootstrap.servers',
'connector.properties.1.value': 'localhost:9092',
'connector.property-version': '1'}
- assert properties == expected
-
- @staticmethod
- def test_property():
- kafka = Kafka()
+ self.assertEqual(expected, properties)
- kafka = kafka.property("group.id", "testGroup")
+ def test_property(self):
+ kafka = Kafka().property("group.id", "testGroup")
properties = kafka.to_properties()
expected = {'connector.type': 'kafka',
'connector.properties.0.key': 'group.id',
'connector.properties.0.value': 'testGroup',
'connector.property-version': '1'}
- assert properties == expected
-
- @staticmethod
- def test_start_from_earliest():
- kafka = Kafka()
+ self.assertEqual(expected, properties)
- kafka = kafka.start_from_earliest()
+ def test_start_from_earliest(self):
+ kafka = Kafka().start_from_earliest()
properties = kafka.to_properties()
expected = {'connector.type': 'kafka',
'connector.startup-mode': 'earliest-offset',
'connector.property-version': '1'}
- assert properties == expected
+ self.assertEqual(expected, properties)
- @staticmethod
- def test_start_from_latest():
- kafka = Kafka()
-
- kafka = kafka.start_from_latest()
+ def test_start_from_latest(self):
+ kafka = Kafka().start_from_latest()
properties = kafka.to_properties()
expected = {'connector.type': 'kafka',
'connector.startup-mode': 'latest-offset',
'connector.property-version': '1'}
- assert properties == expected
+ self.assertEqual(expected, properties)
- @staticmethod
- def test_start_from_group_offsets():
- kafka = Kafka()
-
- kafka = kafka.start_from_group_offsets()
+ def test_start_from_group_offsets(self):
+ kafka = Kafka().start_from_group_offsets()
properties = kafka.to_properties()
expected = {'connector.type': 'kafka',
'connector.startup-mode': 'group-offsets',
'connector.property-version': '1'}
- assert properties == expected
+ self.assertEqual(expected, properties)
@staticmethod
def test_start_from_specific_offsets():
Review comment:
Missing this test case.
----------------------------------------------------------------
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]
With regards,
Apache Git Services