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)

[((123, 157), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 7]'], {}), '([1, 2, 3, 4, 5, 6, 7, 7])\n', (131, 157), True, 'import numpy as np\n'), ((169, 203), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 8]'], {}), '([1, 2, 3, 4, 5, 6, 7, 8])\n', (177, 203), True, 'import numpy as np\n'), ((215, 250), 'hover.utils.metrics.classification_accuracy', 'classification_accuracy', (['true', 'pred'], {}), '(true, pred)\n', (238, 250), False, 'from hover.utils.metrics import classification_accuracy\n'), ((262, 297), 'hover.utils.metrics.classification_accuracy', 'classification_accuracy', (['pred', 'true'], {}), '(pred, true)\n', (285, 297), False, 'from hover.utils.metrics import classification_accuracy\n'), ((309, 333), 'numpy.allclose', 'np.allclose', (['accl', '(7 / 8)'], {}), '(accl, 7 / 8)\n', (320, 333), True, 'import numpy as np\n'), ((343, 367), 'numpy.allclose', 'np.allclose', (['accr', '(7 / 8)'], {}), '(accr, 7 / 8)\n', (354, 367), True, 'import numpy as np\n')]