# Licensed under an MIT open source license - see LICENSE


'''
Test functions for Cramer
'''

from unittest import TestCase

import numpy as np
import numpy.testing as npt

from ..statistics import Cramer_Distance
from ._testing_data import \
    dataset1, dataset2, computed_data, computed_distances


class testCramer(TestCase):

    def setUp(self):
        self.dataset1 = dataset1
        self.dataset2 = dataset2

    def test_cramer(self):
        self.tester = Cramer_Distance(dataset1["cube"][0], dataset2["cube"][0])
        self.tester.distance_metric()
        assert np.allclose(self.tester.data_matrix1,
                           computed_data["cramer_val"])
        npt.assert_almost_equal(self.tester.distance,
                                computed_distances['cramer_distance'])

@@ -793,8 +793,329 @@
 ance'%5D)%0A
+%0A    def test_cramer_spatial_diff(self):%0A%0A        small_data = dataset1%5B%22cube%22%5D%5B0%5D%5B:, :26, :26%5D%0A%0A        self.tester2 = Cramer_Distance(small_data, dataset2%5B%22cube%22%5D%5B0%5D)%0A        self.tester3 = Cramer_Distance(dataset2%5B%22cube%22%5D%5B0%5D, small_data)%0A%0A        npt.assert_almost_equal(self.tester2.distance, self.tester3.distance)%0A%0A

Add test for Cramer with different spatial sizes