def test_rec_random(self): data = [] for i in range(20): data.append((0, randint(0, 40))) data.append((randint(0, 10), randint(-30, 70))) data.append((10, randint(0, 40))) count1 = count2 = 0 for i in axis_aligned_hypotheses(data): count1 += 1 print(count1) for i in axis_aligned_hypotheses2(data): count2 += 1 print(count2) self.assertEqual(count2, count1) data = [] for i in range(50): data.append((randint(-40, 40), randint(-40, 40))) count1 = count2 = 0 for i in axis_aligned_hypotheses(data): count1 += 1 print(count1) for i in axis_aligned_hypotheses2(data): count2 += 1 print(count2) self.assertEqual(count2, count1) count1 = 0 for i in axis_aligned_hypotheses(rand_data2): count1 += 1 self.assertEqual(count1, 1340)
def test_rec_three_points(self): hyps = list(axis_aligned_hypotheses(self._2d[3])) for pp in [[False, False, False], [False, True, False], [True, False, False], [False, False, True], [True, True, False], [True, False, True], [True, True, True]]: self.assertTrue(assign_exists(self._2d[3], hyps, pp))
def test_rec_four_points(self): hyps = list(axis_aligned_hypotheses(self._2d[4])) self.assertEqual(14, len(hyps))
def test_rec_single_point(self): hyps = list(axis_aligned_hypotheses(self._2d[1])) self.assertTrue(assign_exists(self._2d[1], hyps, [True])) self.assertTrue(assign_exists(self._2d[1], hyps, [False]))