переопределении имени «key_pair» из внешней области
Что я могу сделать, чтобы устранить это предупреждение линтера?
Код: Выделить всё
@pytest.fixture(scope="module")
def key_pair():
'''Fixture to generate and load keys'''
assert generate_keys(), "Generation failed: Keys failed to generate"
public_key = load_public_key()
private_key = load_private_key()
assert public_key is not None, "Load failed: Public Key failed to load"
assert private_key is not None, "Load failed: Private Key failed to load"
return public_key, private_key
def test_encryption(key_pair):
'''Test that encryption changes the original value.'''
public_key, _ = key_pair
original_value = 123
encrypted_value = encrypt_number(public_key, 123)
assert encrypted_value != original_value, (
"Encryption failed: Encrypted value equals the original."
)
Подробнее здесь: https://stackoverflow.com/questions/790 ... e-key-pair