예제 #1
0
 def test_unemployment_a_periods_switching_to_e(self):
     """unemployment_a_periods when job seeker starts a training."""
     job_seeker = fhs.JobSeeker({
         'de': [
             {
                 'DATINS': datetime.date(2015, 5, 1),
                 'DATANN': datetime.date(2015, 12, 22),
                 'CATREGR': '1',
             },
             {
                 'DATINS': datetime.date(2015, 12, 22),
                 'DATANN': datetime.date(2015, 12, 31),
                 'CATREGR': '5',
             },
         ],
         'e0': [],
     })
     periods = job_seeker.unemployment_a_periods()
     self.assertEqual(
         fhs.DateIntervals([(
             datetime.date(2015, 5, 1), datetime.date(2015, 12, 22),
             {'DATINS': datetime.date(2015, 5, 1),
              'DATANN': datetime.date(2015, 12, 22),
              'CATREGR': '1'})]),
         periods)
예제 #2
0
 def test_unemployment_a_periods_useless_change(self):
     """unemployment_a_periods whith a change from CATREGR 1 to 2."""
     job_seeker = fhs.JobSeeker({
         'de': [
             {
                 'DATINS': datetime.date(2015, 5, 1),
                 'DATANN': datetime.date(2015, 12, 22),
                 'CATREGR': '1',
                 'MOTINS': 'aaa',
                 'MOTANN': 'bbb',
             },
             {
                 'DATINS': datetime.date(2015, 12, 22),
                 'DATANN': datetime.date(2015, 12, 31),
                 'CATREGR': '2',
                 'MOTINS': 'ccc',
                 'MOTANN': 'ddd',
             },
         ],
         'e0': [],
     })
     periods = job_seeker.unemployment_a_periods()
     self.assertEqual(
         fhs.DateIntervals([(
             datetime.date(2015, 5, 1), datetime.date(2015, 12, 31),
             {'DATINS': datetime.date(2015, 5, 1),
              'DATANN': datetime.date(2015, 12, 31),
              'CATREGR': '2',
              'MOTINS': 'aaa',
              'MOTANN': 'ddd'})]),
         periods)
예제 #3
0
 def test_unemployment_a_periods_switching_to_b(self):
     """unemployment_a_periods when job seeker starts partial work."""
     job_seeker = fhs.JobSeeker({
         'de': [{
             'DATINS': datetime.date(2015, 5, 1),
             'DATANN': datetime.date(2015, 12, 22),
             'CATREGR': '1',
         }],
         'e0': [{
             'MOIS': '201510'
         }, {
             'MOIS': '201511'
         }, {
             'MOIS': '201512'
         }],
     })
     periods = job_seeker.unemployment_a_periods()
     self.assertEqual(
         fhs.DateIntervals([
             (datetime.date(2015, 5, 1), datetime.date(2015, 10, 1), {
                 'DATINS': datetime.date(2015, 5, 1),
                 'DATANN': datetime.date(2015, 10, 1),
                 'CATREGR': '1',
                 'MOTANN': fhs.CancellationReason.STARTING_PART_TIME_WORK
             })
         ]), periods)
예제 #4
0
    def test_unemployment_a_periods_mistakenly_kicked_out(self):
        """unemployment_a_periods with a mistaken kick-out.

        Frequently some job seeker forget the required monthly updated of
        their data, or do not show up at a mandatory meeting with their
        counselor. When that happens Pôle Emploi kicks them out of their
        register (and stop the allowance). Usually the job seeker would then
        re-register very quickly to get their allowance back.

        We identify periods where a job seeker left the unemployment system
        for a short period, and treat such gaps as if they had never left.
        """
        job_seeker = fhs.JobSeeker({
            'de': [
                {
                    'DATINS': datetime.date(2015, 5, 1),
                    'DATANN': datetime.date(2015, 7, 31),
                    'CATREGR': '1',
                    'MOTINS': 'aaa',
                    'MOTANN': 'bbb',
                },
                {
                    'DATINS': datetime.date(2015, 8, 12),
                    'DATANN': datetime.date(2015, 10, 31),
                    'CATREGR': '1',
                    'MOTINS': 'ccc',
                    'MOTANN': 'ddd',
                },
                {
                    'DATINS': datetime.date(2015, 11, 13),
                    'DATANN': None,
                    'CATREGR': '1',
                    'MOTINS': 'eee',
                    'MOTANN': 'fff',
                },
            ],
            'e0': [],
        })
        # The first two periods should be merged, but not the last one.
        periods = job_seeker.unemployment_a_periods(cover_holes_up_to=12)
        self.assertEqual(
            fhs.DateIntervals([
                (datetime.date(2015, 5, 1), datetime.date(2015, 10, 31),
                 {'DATINS': datetime.date(2015, 5, 1),
                  'DATANN': datetime.date(2015, 10, 31),
                  'CATREGR': '1',
                  'MOTINS': 'aaa',
                  'MOTANN': 'ddd'}),
                (datetime.date(2015, 11, 13), None,
                 {'DATINS': datetime.date(2015, 11, 13),
                  'DATANN': None,
                  'CATREGR': '1',
                  'MOTINS': 'eee',
                  'MOTANN': 'fff'})]),
            periods)
예제 #5
0
 def test_unemployment_a_periods(self):
     """Basic usage of unemployment_a_periods."""
     job_seeker = fhs.JobSeeker({
         'de': [{
             'DATINS': datetime.date(2015, 5, 1),
             'DATANN': datetime.date(2015, 5, 22),
             'CATREGR': '1',
             }],
         'e0': [],
     })
     periods = job_seeker.unemployment_a_periods()
     self.assertEqual(
         fhs.DateIntervals([(
             datetime.date(2015, 5, 1), datetime.date(2015, 5, 22),
             {'DATINS': datetime.date(2015, 5, 1),
              'DATANN': datetime.date(2015, 5, 22),
              'CATREGR': '1'})]),
         periods)