@@ -0,0 +1,1975 @@
+import numpy%0Aimport unittest%0Afrom mta.dataset import Dataset%0Afrom mta.profile import Profile%0A%0Aclass TestProfile(unittest.TestCase):%0A    %0A    def setUp(self):%0A        ratings = numpy.loadtxt('cust_ratings',delimiter=',')%0A        touchs = numpy.loadtxt('cust_touchs',delimiter=',')%0A        self.dataset = Dataset(ratings,touchs)%0A    %0A    def test_rating_dist(self):%0A        dist, labels = Profile.rating_dist(self.dataset, stacks=6, stack_range=1)%0A        self.assertEqual(len(labels), 6)%0A        self.assertEqual(len(dist), 6)%0A        self.assertEqual(dist.tolist(), %5B0, 6, 0, 1, 3, 3%5D)%0A%0A    def test_rating_std_dist_on_items(self):%0A        dist, labels = Profile.rating_std_dist_on_items(self.dataset, stacks=6, stack_range=0.5)%0A        self.assertEqual(len(labels), 6)%0A        self.assertEqual(len(dist), 6)%0A        self.assertEqual(dist.tolist(), %5B0, 0, 1, 1, 3, 0%5D)%0A%0A    def test_factor_dist_on_users(self):%0A        dist, labels = Profile.factor_dist_on_users(self.dataset, stacks=6, stack_range=1)%0A        self.assertEqual(len(labels),6)%0A        self.assertEqual(len(dist),6)%0A        self.assertEqual(dist.tolist(),%5B0, 1, 4, 0, 0, 0%5D)%0A%0A    def test_factor_dist_on_items(self):%0A        dist, labels = Profile.factor_dist_on_items(self.dataset, stacks=6, stack_range=1)%0A        self.assertEqual(len(labels),6)%0A        self.assertEqual(len(dist),6)%0A        self.assertEqual(dist.tolist(),%5B0, 0, 2, 3, 0, 0%5D)%0A%0A    def test_item_dist(self):%0A        dist, labels = Profile.item_dist(self.dataset, stacks=6, stack_range=1)%0A        self.assertEqual(len(labels),6)%0A        self.assertEqual(len(dist),6)%0A        self.assertEqual(dist.tolist(),%5B0, 2, 0, 1, 2, 0%5D)%0A%0A    def test_item_dist_on_factors(self):%0A        dist, labels = Profile.item_dist_on_factors(self.dataset, stacks=6, stack_range=1)%0A        self.assertEqual(len(labels),6)%0A        self.assertEqual(len(dist),6)%0A        self.assertEqual(dist.tolist(),%5B0, 0, 0, 1, 0, 2%5D)%0A%0Aif __name__ == '__main__' :%0A    unittest.main()

add test cases of mta/profile