Skip to content

Commit

Permalink
Fixing test
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloem committed Jun 7, 2019
1 parent d516914 commit 2af8398
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions sdks/python/apache_beam/io/fileio_test.py
Expand Up @@ -296,10 +296,11 @@ def test_write_to_single_file_batch(self):
result = (p
| fileio.MatchFiles(FileSystems.join(dir, '*'))
| fileio.ReadMatches()
| beam.FlatMap(lambda f: f.read_utf8().strip().split('\n')))
| beam.FlatMap(lambda f: f.read_utf8().strip().split('\n'))
| beam.Map(json.loads))

assert_that(result,
equal_to([json.dumps(row) for row in self.SIMPLE_COLLECTION]))
equal_to([row for row in self.SIMPLE_COLLECTION]))

def test_write_to_different_file_types_some_spilling(self):

Expand All @@ -321,7 +322,8 @@ def test_write_to_different_file_types_some_spilling(self):
cncf_res = (p
| fileio.MatchFiles(FileSystems.join(dir, 'cncf*'))
| fileio.ReadMatches()
| beam.FlatMap(lambda f: f.read_utf8().strip().split('\n')))
| beam.FlatMap(lambda f: f.read_utf8().strip().split('\n'))
| beam.Map(json.loads))

apache_res = (p
| "MatchApache" >> fileio.MatchFiles(
Expand All @@ -331,7 +333,7 @@ def test_write_to_different_file_types_some_spilling(self):
lambda rf: csv.reader(_get_file_reader(rf))))

assert_that(cncf_res,
equal_to([json.dumps(row)
equal_to([row
for row in self.SIMPLE_COLLECTION
if row['foundation'] == 'cncf']),
label='verifyCNCF')
Expand Down Expand Up @@ -398,7 +400,8 @@ def test_write_to_different_file_types(self):
cncf_res = (p
| fileio.MatchFiles(FileSystems.join(dir, 'cncf*'))
| fileio.ReadMatches()
| beam.FlatMap(lambda f: f.read_utf8().strip().split('\n')))
| beam.FlatMap(lambda f: f.read_utf8().strip().split('\n'))
| beam.Map(json.loads))

apache_res = (p
| "MatchApache" >> fileio.MatchFiles(
Expand All @@ -408,7 +411,7 @@ def test_write_to_different_file_types(self):
lambda rf: csv.reader(_get_file_reader(rf))))

assert_that(cncf_res,
equal_to([json.dumps(row)
equal_to([row
for row in self.SIMPLE_COLLECTION
if row['foundation'] == 'cncf']),
label='verifyCNCF')
Expand Down

0 comments on commit 2af8398

Please sign in to comment.