Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-10697

Python Precommit failing due to type check failure.

Details

    • Bug
    • Status: Resolved
    • P0
    • Resolution: Fixed
    • None
    • 2.24.0
    • sdk-py-core, test-failures
    • None

    Description

      Test suite: https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/
      First failure: https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/3110/

      Looks like it's failing for about a day now.

      Error:

      self = <apache_beam.transforms.ptransform_test.PTransformTypeCheckTestCase testMethod=test_pardo_properly_type_checks_using_type_hint_decorators>
      
          def test_pardo_properly_type_checks_using_type_hint_decorators(self):
            @with_input_types(a=str)
            @with_output_types(typing.List[str])
            def to_all_upper_case(a):
              return [a.upper()]
          
            # If this type-checks than no error should be raised.
            d = (
                self.p
                | 'T' >> beam.Create(['t', 'e', 's', 't']).with_output_types(str)
                | 'Case' >> beam.FlatMap(to_all_upper_case))
            assert_that(d, equal_to(['T', 'E', 'S', 'T']))
            self.p.run()
          
            # Output type should have been recognized as 'str' rather than List[str] to
            # do the flatten part of FlatMap.
      >     self.assertEqual(str, d.element_type)
      E     AssertionError: <type 'str'> != Any
      
      apache_beam/transforms/ptransform_test.py:1182: AssertionError
      

      Attachments

        Activity

          People

            udim Udi Meiri
            danoliveira Daniel Oliveira
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 40m
                1h 40m