'Draw numbers to create a first subsequence then change its date range. Then, try to draw a new number adn check a new subsequence was correctly created.'

def test_ir_sequence_date_range_2_change_dates(self):

    year = (date.today().year - 1)
    january = (lambda d: date(year, 1, d).strftime(DATE_FORMAT))
    seq16 = self.env['ir.sequence'].with_context({'ir_sequence_date': january(16)})
    n = seq16.next_by_code('test_sequence_date_range')
    self.assertEqual(n, '1')
    n = seq16.next_by_code('test_sequence_date_range')
    self.assertEqual(n, '2')
    domain = [('sequence_id.code', '=', 'test_sequence_date_range'), ('date_from', '=', january(1))]
    seq_date_range = self.env['ir.sequence.date_range'].search(domain)
    seq_date_range.write({'date_from': january(18)})
    n = seq16.next_by_code('test_sequence_date_range')
    self.assertEqual(n, '1')
    domain = [('sequence_id.code', '=', 'test_sequence_date_range'), ('date_from', '=', january(1))]
    seq_date_range = self.env['ir.sequence.date_range'].search(domain)
    self.assertEqual(seq_date_range.date_to, january(17))
