def test_record_allocation_angle_type_with_zeros(self): data_set = DriveDataSet([ FeedingData(None, 0.0), FeedingData(None, 0.1), FeedingData(None, -0.1), FeedingData(None, 0.25), FeedingData(None, -0.25), FeedingData(None, -1), FeedingData(None, 0.001), FeedingData(None, 0.251), FeedingData(None, -0.249), ]) allocator = AngleSegmentRecordAllocator( data_set, AngleSegment((-1.0, -0.25), 10), AngleSegment((-0.25, -0.249), 10), AngleSegment((-0.249, -0.1), 10), AngleSegment((-0.1, 0), 10), AngleSegment((0, 0.001), 10), AngleSegment((0.001, 0.1), 10), AngleSegment((0.1, 0.25), 10), AngleSegment((0.25, 0.251), 10), AngleSegment((0.251, 1.001), 10), AngleSegment((1.001, 2.0), 10)) records = allocator.allocate(any_number(), any_number(), len(data_set)) self.assertEqual(same_range_angles(allocator, records, 0), [0.0]) self.assertEqual(same_range_angles(allocator, records, 0.1), [0.1]) self.assertEqual(same_range_angles(allocator, records, -0.1), [-0.1]) self.assertEqual(same_range_angles(allocator, records, 0.25), [0.25]) self.assertEqual(same_range_angles(allocator, records, -0.25), [-0.25]) self.assertEqual(same_range_angles(allocator, records, 1), [0.251]) self.assertEqual(same_range_angles(allocator, records, -1), [-1]) self.assertEqual(same_range_angles(allocator, records, 0.001), [0.001]) self.assertEqual(same_range_angles(allocator, records, -0.001), [-0.1]) self.assertEqual(same_range_angles(allocator, records, 0.252), [0.251]) self.assertEqual(same_range_angles(allocator, records, -0.249), [-0.249])
def test_record_allocation_angle_type_with_zeros_in_range(self): data_set = DriveDataSet([ FeedingData(None, 0.03), FeedingData(None, -0.03), FeedingData(None, 0.15), FeedingData(None, -0.15), FeedingData(None, 0.26), FeedingData(None, -0.26) ]) allocator = AngleTypeWithZeroRecordAllocator(data_set, any_number(), any_number(), any_number(), any_number(), any_number(), 0.25) self.assertEqual(angles(allocator.zero_angles), []) self.assertEqual(angles(allocator.zero_angles_left), []) self.assertEqual(angles(allocator.zero_angles_right), []) self.assertEqual(angles(allocator.center_angles), [0.03, -0.03]) self.assertEqual(angles(allocator.left_angles), [-0.15, -0.26]) self.assertEqual(angles(allocator.right_angles), [0.15, 0.26])