Skip to content

Commit

Permalink
Merge branch 'mapper-pre-filter'
Browse files Browse the repository at this point in the history
  • Loading branch information
David Marin committed Jan 21, 2017
2 parents cd8ed87 + 66088c5 commit df0cc7d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_local.py
Expand Up @@ -737,6 +737,29 @@ def test_pre_filter_failure(self):
lines = [line.strip() for line in list(r.stream_output())]
self.assertEqual(sorted(lines), [])

def test_pre_filter_on_compressed_data(self):
# regression test for #1061
input_gz_path = self.makefile('data.gz')
input_gz = gzip.GzipFile(input_gz_path, 'wb')
input_gz.write(b'x\ny\nz\n')
input_gz.close()

job = FilterJob([
'--mapper-filter', 'cat -e', '--runner=local', input_gz_path])
with job.make_runner() as r:
self.assertEqual(
r._get_steps(),
[{
'type': 'streaming',
'mapper': {
'type': 'script',
'pre_filter': 'cat -e'}}])

r.run()

lines = [line.strip() for line in list(r.stream_output())]
self.assertEqual(sorted(lines), [b'x$', b'y$', b'z$'])


class SetupLineEncodingTestCase(TestCase):

Expand Down

0 comments on commit df0cc7d

Please sign in to comment.