Skip to content

Incorrect test for binary mode in _DownloadReportCheckFormat #152

@parander

Description

@parander

in adwords.py the method _DownloadReportCheckFormat was recently changed. The new test for is_binary_mode is probably incorrect:

  def _DownloadReportCheckFormat(self, file_format, output):
    is_binary_mode = getattr(output, 'mode', 'w') == 'wb'
    if (file_format.startswith('GZIPPED_')
        and not (is_binary_mode or type(output) is io.BytesIO)):
      raise googleads.errors.GoogleAdsValueError('Need to specify a binary'
                                                 ' output for GZIPPED formats.')

This will incorrectly raise an exception for some valid binary mode combinations (e.g r+b, w+b).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions