You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ch...@apache.org on 2019/06/13 20:02:18 UTC

[beam] 01/01: Merge pull request: [BEAM-5270] Read YAML as binary stream in standard_coders_test

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

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

commit 8c8ca6620da5b262ab7b148870556c5342a138a4
Merge: e933ddc 4e05a7f
Author: Chamikara Jayalath <ch...@apache.org>
AuthorDate: Thu Jun 13 13:02:00 2019 -0700

    Merge pull request: [BEAM-5270] Read YAML as binary stream in standard_coders_test

 sdks/python/apache_beam/coders/standard_coders_test.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --cc sdks/python/apache_beam/coders/standard_coders_test.py
index 2ad5ad4,67b3e07..b16a8f5
--- a/sdks/python/apache_beam/coders/standard_coders_test.py
+++ b/sdks/python/apache_beam/coders/standard_coders_test.py
@@@ -49,21 -48,13 +49,22 @@@ def _load_test_cases(test_yaml)
    """
    if not os.path.exists(test_yaml):
      raise ValueError('Could not find the test spec: %s' % test_yaml)
-   for ix, spec in enumerate(yaml.load_all(open(test_yaml))):
-     spec['index'] = ix
-     name = spec.get('name', spec['coder']['urn'].split(':')[-2])
-     yield [name, spec]
+   with open(test_yaml, 'rb') as coder_spec:
+     for ix, spec in enumerate(yaml.load_all(coder_spec)):
+       spec['index'] = ix
+       name = spec.get('name', spec['coder']['urn'].split(':')[-2])
+       yield [name, spec]
  
  
 +def parse_float(s):
 +  x = float(s)
 +  if math.isnan(x):
 +    # In Windows, float('NaN') has opposite sign from other platforms.
 +    # For the purpose of this test, we just need consistency.
 +    x = abs(x)
 +  return x
 +
 +
  class StandardCodersTest(unittest.TestCase):
  
    _urn_to_json_value_parser = {