diff --git a/noise/patterns.py b/noise/patterns.py index 978766b..cca285a 100644 --- a/noise/patterns.py +++ b/noise/patterns.py @@ -60,7 +60,7 @@ class Pattern(object): def get_required_keypairs(self, initiator: bool) -> list: required = [] if initiator: - if self.name[0] in ['K', 'X', 'I']: + if self.name[0] in ('K', 'X', 'I'): required.append('s') if self.one_way or self.name[1] == 'K': required.append('rs') diff --git a/tests/test_vectors.py b/tests/test_vectors.py index 990cf68..2eece8c 100644 --- a/tests/test_vectors.py +++ b/tests/test_vectors.py @@ -15,10 +15,10 @@ vector_files = [ # As in test vectors specification (https://github.com/noiseprotocol/noise_wiki/wiki/Test-vectors) # We use this to cast read strings into bytes -byte_fields = ['protocol_name'] -hexbyte_fields = ['init_prologue', 'init_static', 'init_ephemeral', 'init_remote_static', 'resp_static', - 'resp_prologue', 'resp_ephemeral', 'resp_remote_static', 'handshake_hash'] -list_fields = ['init_psks', 'resp_psks'] +byte_field = 'protocol_name' +hexbyte_fields = ('init_prologue', 'init_static', 'init_ephemeral', 'init_remote_static', 'resp_static', + 'resp_prologue', 'resp_ephemeral', 'resp_remote_static', 'handshake_hash') +list_fields = ('init_psks', 'resp_psks') dict_field = 'messages' @@ -31,7 +31,7 @@ def _prepare_test_vectors(): for vector in vectors_list: for key, value in vector.copy().items(): - if key in byte_fields: + if key == byte_field: vector[key] = value.encode() if key in hexbyte_fields: vector[key] = bytes.fromhex(value)