[ 
https://issues.apache.org/jira/browse/BEAM-8224?focusedWorklogId=312358&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312358
 ]

ASF GitHub Bot logged work on BEAM-8224:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Sep/19 21:37
            Start Date: 13/Sep/19 21:37
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on pull request #9563: [BEAM-8224] 
Fix bug in _fn_takes_side_inputs
URL: https://github.com/apache/beam/pull/9563#discussion_r324376583
 
 

 ##########
 File path: sdks/python/apache_beam/typehints/typed_pipeline_test.py
 ##########
 @@ -221,9 +221,46 @@ def repeat(s, *times):
     result = ['a', 'bb', 'c'] | beam.Map(repeat, 3)
     self.assertEqual(['aaa', 'bbbbbb', 'ccc'], sorted(result))
 
-  # TODO(robertwb): Support partially defined varargs.
-  # with self.assertRaises(typehints.TypeCheckError):
-  #   ['a', 'bb', 'c'] | beam.Map(repeat, 'z')
+    if sys.version_info >= (3,):
+      with self.assertRaisesRegexp(
+          typehints.TypeCheckError,
+          r'requires Tuple\[int, ...\] but got Tuple\[str, ...\]'):
+        ['a', 'bb', 'c'] | beam.Map(repeat, 'z')
+
+  def test_var_positional_only_side_input_hint(self):
+    # Test that a lambda that accepts only a VAR_POSITIONAL can accept
+    # side-inputs.
+    result = (['a', 'b', 'c']
+              | beam.Map(lambda *_: 'a', 5).with_input_types(str, int))
 
 Review comment:
   Let's check that it actually gets the values right, e.g. do `lambda *args: 
args`. (Similarly below.)
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 312358)
    Time Spent: 1h 40m  (was: 1.5h)

> The way we inspect arguments in Python does not work for lambda *_: ...
> -----------------------------------------------------------------------
>
>                 Key: BEAM-8224
>                 URL: https://issues.apache.org/jira/browse/BEAM-8224
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Yueyang Qiu
>            Assignee: Udi Meiri
>            Priority: Blocker
>             Fix For: 2.16.0
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> We need to make it work and create a test for this case.
>  
> Assigning to Udi who authored 
> [https://github.com/apache/beam/pull/9283|https://www.google.com/url?q=https://github.com/apache/beam/pull/9283&sa=D&usg=AFQjCNETtLzhe9jPfGzLHJb2N4Sle-FuNw].



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to