Abacn opened a new issue, #23254:
URL: https://github.com/apache/beam/issues/23254

   ### What happened?
   
   e.g. https://ci-beam.apache.org/job/beam_PreCommit_Python_Commit/24753/
   
   following test failed 
   ```
   
apache_beam.coders.coders_property_based_test.ProperyTestingCoders.test_row_coder
   
apache_beam.coders.coders_property_based_test.ProperyTestingCoders.test_row_coder
   ```
   
   error message:
   ```
   ValueError: Type names and field names cannot be a keyword: 'as'
   Falsifying example: test_row_coder(
       data=data(...),
       self=<apache_beam.coders.coders_property_based_test.ProperyTestingCoders 
testMethod=test_row_coder>,
   )
   Draw 1: [('as', <class 'str'>, False)]
   
   You can reproduce this example by temporarily adding 
@reproduce_failure('6.54.5', b'AAEBJQE3AAAAAA==') as a decorator on your test 
case
   Stacktrace
   self = <apache_beam.coders.coders_property_based_test.ProperyTestingCoders 
testMethod=test_row_coder>
   
       @settings(deadline=None, print_blob=True)
   >   @given(st.data())
   
   apache_beam/coders/coders_property_based_test.py:119: 
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ 
   apache_beam/coders/coders_property_based_test.py:135: in test_row_coder
       RowType = typing.NamedTuple(  # type: ignore
   /usr/lib/python3.8/typing.py:1704: in __new__
       return _make_nmtuple(typename, fields)
   /usr/lib/python3.8/typing.py:1594: in _make_nmtuple
       nm_tpl = collections.namedtuple(name, [n for n, t in types])
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ 
   
   typename = 'RandomRowType', field_names = ['as']
   
       def namedtuple(typename, field_names, *, rename=False, defaults=None, 
module=None):
           """Returns a new subclass of tuple with named fields.
       
           >>> Point = namedtuple('Point', ['x', 'y'])
           >>> Point.__doc__                   # docstring for the new class
           'Point(x, y)'
           >>> p = Point(11, y=22)             # instantiate with positional 
args or keywords
           >>> p[0] + p[1]                     # indexable like a plain tuple
           33
           >>> x, y = p                        # unpack like a regular tuple
           >>> x, y
           (11, 22)
           >>> p.x + p.y                       # fields also accessible by name
           33
           >>> d = p._asdict()                 # convert to a dictionary
           >>> d['x']
           11
           >>> Point(**d)                      # convert from a dictionary
           Point(x=11, y=22)
           >>> p._replace(x=100)               # _replace() is like 
str.replace() but targets named fields
           Point(x=100, y=22)
       
           """
       
           # Validate the field names.  At the user's option, either generate 
an error
           # message or automatically replace the field name with a valid name.
           if isinstance(field_names, str):
               field_names = field_names.replace(',', ' ').split()
           field_names = list(map(str, field_names))
           typename = _sys.intern(str(typename))
       
           if rename:
               seen = set()
               for index, name in enumerate(field_names):
                   if (not name.isidentifier()
                       or _iskeyword(name)
                       or name.startswith('_')
                       or name in seen):
                       field_names[index] = f'_{index}'
                   seen.add(name)
       
           for name in [typename] + field_names:
               if type(name) is not str:
                   raise TypeError('Type names and field names must be strings')
               if not name.isidentifier():
                   raise ValueError('Type names and field names must be valid '
                                    f'identifiers: {name!r}')
               if _iskeyword(name):
   >               raise ValueError('Type names and field names cannot be a '
                                    f'keyword: {name!r}')
   E               ValueError: Type names and field names cannot be a keyword: 
'as'
   E               Falsifying example: test_row_coder(
   E                   data=data(...),
   E                   
self=<apache_beam.coders.coders_property_based_test.ProperyTestingCoders 
testMethod=test_row_coder>,
   E               )
   E               Draw 1: [('as', <class 'str'>, False)]
   E               
   E               You can reproduce this example by temporarily adding 
@reproduce_failure('6.54.5', b'AAEBJQE3AAAAAA==') as a decorator on your test 
case
   
   /usr/lib/python3.8/collections/__init__.py:361: ValueError
   ```
   
   Not sure this is transient or flakes. Will track.
   
   ### Issue Priority
   
   Priority: 2
   
   ### Issue Component
   
   Component: test-failures


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to