Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions sdks/python/apache_beam/examples/matrix_power_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

"""Test for the matrix power integration test."""

import glob
import logging
import tempfile
import unittest
Expand Down Expand Up @@ -51,9 +52,15 @@ def test_basics(self):
'--input_matrix=%s --input_vector=%s --exponent=%d --output=%s.result' %
(matrix_path, vector_path, self.EXPONENT, vector_path)).split())
# Parse result file and compare.
with open(vector_path + '.result-00000-of-00001') as result_file:
results = result_file.read()
self.assertEqual(sorted(self.EXPECTED_OUTPUT), sorted(results))
shard_paths = glob.glob(vector_path + '.result*')
self.assertTrue(
shard_paths,
'No output shards found matching prefix: %s.result' % vector_path)
results = []
for path in shard_paths:
with open(path) as result_file:
results.append(result_file.read())
self.assertEqual(sorted(self.EXPECTED_OUTPUT), sorted(''.join(results)))
Comment thread
shunping marked this conversation as resolved.


if __name__ == '__main__':
Expand Down
Loading