You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/03/21 20:40:39 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #17108: Minor: Bypass schema registry in schemas_test.py

TheNeuralBit commented on a change in pull request #17108:
URL: https://github.com/apache/beam/pull/17108#discussion_r831523945



##########
File path: sdks/python/apache_beam/typehints/schemas_test.py
##########
@@ -91,12 +93,34 @@ def test_typing_survives_proto_roundtrip(self):
 
     test_cases = all_primitives + \
                  basic_array_types + \
-                 basic_map_types + \
-                 selected_schemas
+                 basic_map_types
 
     for test_case in test_cases:
       self.assertEqual(
-          test_case, typing_from_runner_api(typing_to_runner_api(test_case)))
+          test_case, typing_from_runner_api(
+              typing_to_runner_api(test_case,
+                                   schema_registry=SchemaTypeRegistry()),
+              schema_registry=SchemaTypeRegistry()
+          ))
+
+    for test_case in selected_schemas:
+      self.assert_namedtuple_equivalent(
+          test_case, typing_from_runner_api(
+              typing_to_runner_api(test_case,
+                                   schema_registry=SchemaTypeRegistry()),
+              schema_registry=SchemaTypeRegistry()
+          ))
+
+
+  def assert_namedtuple_equivalent(self, actual, expected):
+    # We can't check for equality between types
+    self.assertTrue(match_is_named_tuple(expected))
+    self.assertTrue(match_is_named_tuple(actual))

Review comment:
       I updated this comment with an explanation, thanks!

##########
File path: sdks/python/apache_beam/typehints/schemas_test.py
##########
@@ -91,12 +93,34 @@ def test_typing_survives_proto_roundtrip(self):
 
     test_cases = all_primitives + \
                  basic_array_types + \
-                 basic_map_types + \
-                 selected_schemas
+                 basic_map_types
 
     for test_case in test_cases:
       self.assertEqual(
-          test_case, typing_from_runner_api(typing_to_runner_api(test_case)))
+          test_case, typing_from_runner_api(
+              typing_to_runner_api(test_case,
+                                   schema_registry=SchemaTypeRegistry()),
+              schema_registry=SchemaTypeRegistry()
+          ))
+
+    for test_case in selected_schemas:

Review comment:
       We only break them out here because of the issue checking equality between NamedTuple types, in that test we can still just check for equality between the generated protos




-- 
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-unsubscribe@beam.apache.org

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