Skip to content

Commit

Permalink
Make headers a tuple to be hashable
Browse files Browse the repository at this point in the history
  • Loading branch information
tvoinarovskyi committed Jan 20, 2019
1 parent 2777c9f commit 70e4af6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion aiokafka/consumer/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _consumer_record(self, tp, record):
return ConsumerRecord(
tp.topic, tp.partition, record.offset, record.timestamp,
record.timestamp_type, key, value, record.checksum,
key_size, value_size, record.headers)
key_size, value_size, tuple(record.headers))


class Fetcher:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1897,4 +1897,4 @@ def test_consumer_with_headers(self):

message = yield from consumer.getone()
self.assertEqual(message.value, b"0")
self.assertEqual(message.headers, [("header1", b"17")])
self.assertEqual(message.headers, (("header1", b"17"), ))
2 changes: 1 addition & 1 deletion tests/test_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def _setup_error_after_data(self):
messages = [ConsumerRecord(
topic="some_topic", partition=1, offset=0, timestamp=0,
timestamp_type=0, key=None, value=b"some", checksum=None,
serialized_key_size=0, serialized_value_size=4)]
serialized_key_size=0, serialized_value_size=4, headers=[])]
partition_records = PartitionRecords(
tp2, mock.Mock(), [], 0,
None, None, False, READ_UNCOMMITTED)
Expand Down

0 comments on commit 70e4af6

Please sign in to comment.