Exemplo n.º 1
0
def test_lines_completes(gzip_stream):
	"""
	When reading lines from a gzip stream, the operation should complete
	when the stream is exhausted.
	"""
	chunks = gzip.read_chunks(gzip_stream)
	streams = gzip.load_streams(chunks)
	lines = flatten(map(gzip.lines_from_stream, streams))
	consume(lines)
Exemplo n.º 2
0
def test_lines_from_stream(gzip_stream):
	chunks = gzip.read_chunks(gzip_stream)
	streams = gzip.load_streams(chunks)
	lines = flatten(map(gzip.lines_from_stream, streams))
	first_line = next(lines)
	assert first_line == '['
	second_line = next(lines)
	result = json.loads(second_line.rstrip('\n,'))
	assert isinstance(result, dict)
	assert 'id' in result