from hover.utils.metrics import classification_accuracy
import numpy as np

def test_classification_accuracy():
    true = np.array([1, 2, 3, 4, 5, 6, 7, 7])
    pred = np.array([1, 2, 3, 4, 5, 6, 7, 8])
    accl = classification_accuracy(true, pred)
    accr = classification_accuracy(pred, true)
    assert np.allclose(accl, 7/8)
    assert np.allclose(accr, 7/8)

[((5, 11, 5, 45), 'numpy.array', 'np.array', ({(5, 20, 5, 44): '[1, 2, 3, 4, 5, 6, 7, 7]'}, {}), '([1, 2, 3, 4, 5, 6, 7, 7])', True, 'import numpy as np\n'), ((6, 11, 6, 45), 'numpy.array', 'np.array', ({(6, 20, 6, 44): '[1, 2, 3, 4, 5, 6, 7, 8]'}, {}), '([1, 2, 3, 4, 5, 6, 7, 8])', True, 'import numpy as np\n'), ((7, 11, 7, 46), 'hover.utils.metrics.classification_accuracy', 'classification_accuracy', ({(7, 35, 7, 39): 'true', (7, 41, 7, 45): 'pred'}, {}), '(true, pred)', False, 'from hover.utils.metrics import classification_accuracy\n'), ((8, 11, 8, 46), 'hover.utils.metrics.classification_accuracy', 'classification_accuracy', ({(8, 35, 8, 39): 'pred', (8, 41, 8, 45): 'true'}, {}), '(pred, true)', False, 'from hover.utils.metrics import classification_accuracy\n'), ((9, 11, 9, 33), 'numpy.allclose', 'np.allclose', ({(9, 23, 9, 27): 'accl', (9, 29, 9, 32): '(7 / 8)'}, {}), '(accl, 7 / 8)', True, 'import numpy as np\n'), ((10, 11, 10, 33), 'numpy.allclose', 'np.allclose', ({(10, 23, 10, 27): 'accr', (10, 29, 10, 32): '(7 / 8)'}, {}), '(accr, 7 / 8)', True, 'import numpy as np\n')]