You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2016/11/03 17:32:28 UTC

[1/2] incubator-beam git commit: Fixes two bugs in avroio_test 'test_corrupted_file'.

Repository: incubator-beam
Updated Branches:
  refs/heads/python-sdk 7e870613f -> 9d2acc98e


Fixes two bugs in avroio_test 'test_corrupted_file'.

(1) Updates test to perform corruption properly (setting 'A' and 'B').
(2) Removes an invalid usage of bytearray().


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/a7e543a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/a7e543a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/a7e543a1

Branch: refs/heads/python-sdk
Commit: a7e543a15f0db890a80777251719db2d05001ba2
Parents: 7e87061
Author: Chamikara Jayalath <ch...@google.com>
Authored: Wed Nov 2 14:33:09 2016 -0700
Committer: Chamikara Jayalath <ch...@google.com>
Committed: Wed Nov 2 14:44:12 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/a7e543a1/sdks/python/apache_beam/io/avroio_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/avroio_test.py b/sdks/python/apache_beam/io/avroio_test.py
index f72c3f3..9e356ca 100644
--- a/sdks/python/apache_beam/io/avroio_test.py
+++ b/sdks/python/apache_beam/io/avroio_test.py
@@ -228,15 +228,16 @@ class TestAvro(unittest.TestCase):
   def test_corrupted_file(self):
     file_name = self._write_data()
     with open(file_name, 'rb') as f:
-      data = bytearray(f.read())
+      data = f.read()
 
     # Corrupt the last character of the file which is also the last character of
     # the last sync_marker.
+    last_char_index = len(data) - 1
+    corrupted_data = data[:last_char_index]
+    corrupted_data += 'A' if data[last_char_index] == 'B' else 'B'
     with tempfile.NamedTemporaryFile(
         delete=False, prefix=tempfile.template) as f:
-      last_char_index = len(data) - 1
-      data[last_char_index] = 'A' if data[last_char_index] == 'B' else 'A'
-      f.write(data)
+      f.write(corrupted_data)
       corrupted_file_name = f.name
 
     source = AvroSource(corrupted_file_name)


[2/2] incubator-beam git commit: Closes #1267

Posted by ro...@apache.org.
Closes #1267


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/9d2acc98
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/9d2acc98
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/9d2acc98

Branch: refs/heads/python-sdk
Commit: 9d2acc98e129ad83003111a463741d7ea07ee7ae
Parents: 7e87061 a7e543a
Author: Robert Bradshaw <ro...@google.com>
Authored: Thu Nov 3 10:32:08 2016 -0700
Committer: Robert Bradshaw <ro...@google.com>
Committed: Thu Nov 3 10:32:08 2016 -0700

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