You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by bh...@apache.org on 2022/05/06 00:30:25 UTC

[beam] branch master updated: [BEAM-5878] Add (failing) kwonly-argument test (#17509)

This is an automated email from the ASF dual-hosted git repository.

bhulette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d3b4bbaa94 [BEAM-5878] Add (failing) kwonly-argument test (#17509)
8d3b4bbaa94 is described below

commit 8d3b4bbaa942d62ac16b7ca7ff8858e102497b46
Author: Brian Hulette <bh...@google.com>
AuthorDate: Thu May 5 17:30:19 2022 -0700

    [BEAM-5878] Add (failing) kwonly-argument test (#17509)
---
 sdks/python/apache_beam/runners/common_test.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/sdks/python/apache_beam/runners/common_test.py b/sdks/python/apache_beam/runners/common_test.py
index c089d5a0228..de2633683c7 100644
--- a/sdks/python/apache_beam/runners/common_test.py
+++ b/sdks/python/apache_beam/runners/common_test.py
@@ -50,6 +50,25 @@ class DoFnSignatureTest(unittest.TestCase):
     with self.assertRaises(ValueError):
       DoFnSignature(MyDoFn())
 
+  def test_dofn_get_defaults(self):
+    class MyDoFn(DoFn):
+      def process(self, element, w=DoFn.WindowParam):
+        pass
+
+    signature = DoFnSignature(MyDoFn())
+
+    self.assertEqual(signature.process_method.defaults, [DoFn.WindowParam])
+
+  @unittest.skip('BEAM-5878')
+  def test_dofn_get_defaults_kwonly(self):
+    class MyDoFn(DoFn):
+      def process(self, element, *, w=DoFn.WindowParam):
+        pass
+
+    signature = DoFnSignature(MyDoFn())
+
+    self.assertEqual(signature.process_method.defaults, [DoFn.WindowParam])
+
   def test_dofn_validate_start_bundle_error(self):
     class MyDoFn(DoFn):
       def process(self, element):