# Path: drudge/fock.py
# CR = CranChar.CR
# 
# AN = CranChar.AN
# 
# Path: drudge/utils.py
# def sympy_key(expr):
#     """Get the key for ordering SymPy expressions.
# 
#     This function assumes that the given expression is already sympified.
#     """
# 
#     return count_ops(expr), default_sort_key(expr)


import pickle
from sympy import latex, KroneckerDelta
from drudge import CR, AN
from drudge.utils import sympy_key





def test_ancr_character_has_basic_properties():
    """Test the annihilation and creation character singleton values.

    This test case also serves as the test for the general concrete symbol
    utility class and meta-class.
    """

    # Its objects will be serialized and deserialized.
    n_cr, n_an = [pickle.loads(pickle.dumps(i)) for i in [CR, AN]]

    # We test both the original value and the deserialized values.
    for cr, an in [(CR, AN), (n_cr, n_an)]:
        # Printing, all kinds of printing.
        assert str(cr) == 'CR'
        assert str(an) == 'AN'
        assert repr(cr) == 'CranChar.CR'
        assert repr(an) == 'CranChar.AN'
        assert latex(cr) == r'\dagger'
        assert latex(an) == ''

        # Ordering, in its original form and as SymPy key.
        assert cr == cr
        assert an == an
        assert cr < an
        assert not cr > an

# Path: drudge/fock.py
# CR = CranChar.CR
# 
# AN = CranChar.AN
# 
# Path: drudge/utils.py
# def sympy_key(expr):
#     """Get the key for ordering SymPy expressions.
# 
#     This function assumes that the given expression is already sympified.
#     """
# 
#     return count_ops(expr), default_sort_key(expr)


# Path: tests/basic_wick_test.py
import pickle
from sympy import latex, KroneckerDelta
from drudge import CR, AN
from drudge.utils import sympy_key






def test_ancr_character_has_basic_properties():
    """Test the annihilation and creation character singleton values.

    This test case also serves as the test for the general concrete symbol
    utility class and meta-class.
    """

    # Its objects will be serialized and deserialized.
    n_cr, n_an = [pickle.loads(pickle.dumps(i)) for i in [CR, AN]]

    # We test both the original value and the deserialized values.
    for cr, an in [(CR, AN), (n_cr, n_an)]:
        # Printing, all kinds of printing.
        assert str(cr) == 'CR'
        assert str(an) == 'AN'
        assert repr(cr) == 'CranChar.CR'
        assert repr(an) == 'CranChar.AN'
        assert latex(cr) == r'\dagger'
        assert latex(an) == ''

        # Ordering, in its original form and as SymPy key.
        assert cr == cr
        assert an == an
        assert cr < an
        assert not cr > an

        assert sympy_key(cr) == sympy_key(cr)