# Path: openfermioncirq/_compat_test.py
# def deprecated_test(test: Callable) -> Callable:
#     """Marks a test as using deprecated functionality.
# 
#     Ensures the test is executed within the `pytest.deprecated_call()` context.
# 
#     Args:
#         test: The test.
# 
#     Returns:
#         The decorated test.
#     """
# 
#     @functools.wraps(test)
#     def decorated_test(*args, **kwargs) -> Any:
#         with pytest.deprecated_call():
#             test(*args, **kwargs)
# 
#     return decorated_test


import warnings
import numpy as np
import sympy
import cirq
import pytest
import openfermioncirq as ofc
from scipy.linalg import expm, kron
from openfermioncirq._compat_test import deprecated_test
def test_fswap_str():
    assert str(ofc.FSWAP) == 'FSWAP'
    assert str(ofc.FSWAP**0.5) == 'FSWAP**0.5'
    assert str(ofc.FSWAP**-0.25) == 'FSWAP**-0.25'


def test_fswap_repr():
    assert repr(ofc.FSWAP) == 'ofc.FSWAP'
    assert repr(ofc.FSWAP**0.5) == '(ofc.FSWAP**0.5)'
    assert repr(ofc.FSWAP**-0.25) == '(ofc.FSWAP**-0.25)'

    ofc.testing.assert_equivalent_repr(ofc.FSWAP)
    ofc.testing.assert_equivalent_repr(ofc.FSWAP**0.5)
    ofc.testing.assert_equivalent_repr(ofc.FSWAP**-0.25)


def test_fswap_matrix():
    np.testing.assert_allclose(
        cirq.unitary(ofc.FSWAP),
        np.array([[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, -1]]))

    np.testing.assert_allclose(
        cirq.unitary(ofc.FSWAP**0.5),
        np.array([[1, 0, 0, 0], [0, 0.5 + 0.5j, 0.5 - 0.5j, 0],
                  [0, 0.5 - 0.5j, 0.5 + 0.5j, 0], [0, 0, 0, 1j]]))

    cirq.testing.assert_has_consistent_apply_unitary_for_various_exponents(
        val=ofc.FSWAP, exponents=[1])



# Path: openfermioncirq/_compat_test.py
# def deprecated_test(test: Callable) -> Callable:
#     """Marks a test as using deprecated functionality.
# 
#     Ensures the test is executed within the `pytest.deprecated_call()` context.
# 
#     Args:
#         test: The test.
# 
#     Returns:
#         The decorated test.
#     """
# 
#     @functools.wraps(test)
#     def decorated_test(*args, **kwargs) -> Any:
#         with pytest.deprecated_call():
#             test(*args, **kwargs)
# 
#     return decorated_test


# Path: openfermioncirq/gates/common_gates_test.py
import warnings
import numpy as np
import sympy
import cirq
import pytest
import openfermioncirq as ofc
from scipy.linalg import expm, kron
from openfermioncirq._compat_test import deprecated_test

def test_fswap_str():
    assert str(ofc.FSWAP) == 'FSWAP'
    assert str(ofc.FSWAP**0.5) == 'FSWAP**0.5'
    assert str(ofc.FSWAP**-0.25) == 'FSWAP**-0.25'


def test_fswap_repr():
    assert repr(ofc.FSWAP) == 'ofc.FSWAP'
    assert repr(ofc.FSWAP**0.5) == '(ofc.FSWAP**0.5)'
    assert repr(ofc.FSWAP**-0.25) == '(ofc.FSWAP**-0.25)'

    ofc.testing.assert_equivalent_repr(ofc.FSWAP)
    ofc.testing.assert_equivalent_repr(ofc.FSWAP**0.5)
    ofc.testing.assert_equivalent_repr(ofc.FSWAP**-0.25)


def test_fswap_matrix():
    np.testing.assert_allclose(
        cirq.unitary(ofc.FSWAP),
        np.array([[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, -1]]))

    np.testing.assert_allclose(
        cirq.unitary(ofc.FSWAP**0.5),
        np.array([[1, 0, 0, 0], [0, 0.5 + 0.5j, 0.5 - 0.5j, 0],
                  [0, 0.5 - 0.5j, 0.5 + 0.5j, 0], [0, 0, 0, 1j]]))

    cirq.testing.assert_has_consistent_apply_unitary_for_various_exponents(
        val=ofc.FSWAP, exponents=[1])



@deprecated_test