def testClusterToTourModel(self): data = cp.cluster_to_tour_model(None, None) #for a negative test case self.assertTrue(not data) #checking that the code doesn't crash on an empty dataset data = cp.read_data(size=100)#this and the following lines form the positive test case data, bins = cp.remove_noise(data, 300) n, labels, data = cp.cluster(data, len(bins)) tour_dict = cp.main() self.assertTrue(len(tour_dict) <= n)
def testClusterToTourModel(self): # Test to make sure it doesn't crash on a empty dataset data = cp.cluster_to_tour_model(None, None) self.assertFalse(data) # Test with the real dataset data = cp.read_data(uuid=self.testUUID) data, bins = cp.remove_noise(data, self.RADIUS) n, labels, data = cp.cluster(data, len(bins)) tour_dict = cp.main(uuid=self.testUUID) self.assertTrue(len(tour_dict) <= n)
def testClusterToTourModelNew(self): data = cp.cluster_to_tour_model(None, None, old=False) #for a negative test case self.assertTrue(not data) #checking that the code doesn't crash on an empty dataset user_name = "test1" data = cp.read_data(uuid=self.testUUID, size=100, old=False) #this and the following lines form the positive test case data, bins = cp.remove_noise(data, 300, old=False) n, labels, data = cp.cluster(data, len(bins), old=False) tour_dict = cp.main(uuid=user_name, old=False) print 'n = %s | len(tour_dict) = %s' % (n, len(tour_dict)) self.assertTrue(len(tour_dict) <= n)