import pytest

from aead import AEAD


hypothesis = pytest.importorskip("hypothesis")


@hypothesis.given(bytes, bytes)
def test_round_trip_encrypt_decrypt(plaintext, associated_data):
    cryptor = AEAD(AEAD.generate_key())
    ct = cryptor.encrypt(plaintext, associated_data)
    assert plaintext == cryptor.decrypt(ct, associated_data)

import pytest

from aead import AEAD


hypothesis = pytest.importorskip("hypothesis")


@hypothesis.given(
    hypothesis.strategies.binary(),
    hypothesis.strategies.binary()
)
def test_round_trip_encrypt_decrypt(plaintext, associated_data):
    cryptor = AEAD(AEAD.generate_key())
    ct = cryptor.encrypt(plaintext, associated_data)
    assert plaintext == cryptor.decrypt(ct, associated_data)

Fix the Hypothesis test to work with new API.
Fix the Hypothesis test to work with new API.

The Hypothesis API has since moved on from the last time we pushed
a change. Fix the test suite to work with the new API.

  import pytest
  
  from aead import AEAD
  
  
  hypothesis = pytest.importorskip("hypothesis")
  
  
- @hypothesis.given(bytes, bytes)
+ @hypothesis.given(
+     hypothesis.strategies.binary(),
+     hypothesis.strategies.binary()
+ )
  def test_round_trip_encrypt_decrypt(plaintext, associated_data):
      cryptor = AEAD(AEAD.generate_key())
      ct = cryptor.encrypt(plaintext, associated_data)
      assert plaintext == cryptor.decrypt(ct, associated_data)
  
Fix the Hypothesis test to work with new API.
## Code Before:
import pytest

from aead import AEAD


hypothesis = pytest.importorskip("hypothesis")


@hypothesis.given(bytes, bytes)
def test_round_trip_encrypt_decrypt(plaintext, associated_data):
    cryptor = AEAD(AEAD.generate_key())
    ct = cryptor.encrypt(plaintext, associated_data)
    assert plaintext == cryptor.decrypt(ct, associated_data)

## Instruction:
Fix the Hypothesis test to work with new API.
## Code After:
import pytest

from aead import AEAD


hypothesis = pytest.importorskip("hypothesis")


@hypothesis.given(
    hypothesis.strategies.binary(),
    hypothesis.strategies.binary()
)
def test_round_trip_encrypt_decrypt(plaintext, associated_data):
    cryptor = AEAD(AEAD.generate_key())
    ct = cryptor.encrypt(plaintext, associated_data)
    assert plaintext == cryptor.decrypt(ct, associated_data)
