Exemplo n.º 1
0
def test_check_allowable_frequencies():
    rule = Rule(
        recurrence.WEEKLY
    )

    limits = Recurrence(
        rrules=[rule]
    )

    value = recurrence.serialize(limits)

    field = RecurrenceField(frequencies=[
        recurrence.WEEKLY
    ])
    field.clean(value)

    field = RecurrenceField(frequencies=[
        recurrence.YEARLY
    ])
    with pytest.raises(forms.ValidationError) as e:
        field.clean(value)
    assert e.value.messages[0] == "Invalid frequency."

    limits = Recurrence(
        exrules=[rule]
    )

    value = recurrence.serialize(limits)

    with pytest.raises(forms.ValidationError) as e:
        field.clean(value)
    assert e.value.messages[0] == "Invalid frequency."
def test_invalid_frequency_recurrence_object_raises():
    with pytest.raises(recurrence.SerializationError):
        EventWithNoNulls.objects.create(recurs=Recurrence(
            rrules=[Rule('fish')]))

    with pytest.raises(recurrence.SerializationError):
        EventWithNoNulls.objects.create(recurs=Recurrence(rrules=[Rule(42)]))
def test_exclusion_date():
    rule = Rule(
        recurrence.DAILY
    )

    pattern = Recurrence(
        dtstart=datetime(2014, 1, 2, 0, 0, 0),
        dtend=datetime(2014, 1, 4, 0, 0, 0),
        rrules=[rule],
        exdates=[
            datetime(2014, 1, 3, 0, 0, 0)
        ]
    )

    occurrences = [
        instance for instance in
        pattern.occurrences()
    ]

    assert occurrences == [
        datetime(2014, 1, 2, 0, 0, 0),
        datetime(2014, 1, 4, 0, 0, 0),
    ]

    assert 2 == pattern.count()
def test_exclusion_rule():
    inclusion_rule = Rule(
        recurrence.DAILY
    )

    exclusion_rule = Rule(
        recurrence.WEEKLY,
        byday=recurrence.THURSDAY
    )

    pattern = Recurrence(
        dtstart=datetime(2014, 1, 2, 0, 0, 0),
        dtend=datetime(2014, 1, 4, 0, 0, 0),
        rrules=[inclusion_rule],
        exrules=[exclusion_rule]
    )

    occurrences = [
        instance for instance in
        pattern.occurrences()
    ]

    assert occurrences == [
        datetime(2014, 1, 3, 0, 0, 0),
        datetime(2014, 1, 4, 0, 0, 0),
    ]

    assert 2 == pattern.count()
Exemplo n.º 5
0
def test_occurrences_until():
    rule = Rule(recurrence.DAILY, until=datetime(2014, 1, 3, 0, 0, 0))

    pattern = Recurrence(rrules=[rule])

    occurrences = [
        instance
        for instance in pattern.occurrences(dtstart=datetime(2014, 1, 1, 0, 0, 0), dtend=datetime(2014, 1, 5, 0, 0, 0))
    ]

    assert occurrences == [
        datetime(2014, 1, 1, 0, 0, 0),
        datetime(2014, 1, 2, 0, 0, 0),
        datetime(2014, 1, 3, 0, 0, 0),
        # We always get dtend, for reasons that aren't entirely clear
        datetime(2014, 1, 5, 0, 0, 0),
    ]

    assert 4 == pattern.count(dtstart=datetime(2014, 1, 1, 0, 0, 0), dtend=datetime(2014, 1, 5, 0, 0, 0))

    occurrences = [
        instance
        for instance in pattern.occurrences(dtstart=datetime(2014, 1, 1, 0, 0, 0), dtend=datetime(2014, 1, 2, 0, 0, 0))
    ]

    assert occurrences == [datetime(2014, 1, 1, 0, 0, 0), datetime(2014, 1, 2, 0, 0, 0)]

    assert 2 == pattern.count(dtstart=datetime(2014, 1, 1, 0, 0, 0), dtend=datetime(2014, 1, 2, 0, 0, 0))
def test_invalid_interval_recurrence_object_raises():
    with pytest.raises(recurrence.SerializationError):
        EventWithNoNulls.objects.create(recurs=Recurrence(
            rrules=[Rule(recurrence.DAILY, interval=0)]))

    with pytest.raises(recurrence.SerializationError):
        EventWithNoNulls.objects.create(recurs=Recurrence(
            rrules=[Rule(recurrence.DAILY, interval='cat')]))
def test_occurrences_with_start_and_end_weekly_tuesdays():
    rule = Rule(recurrence.WEEKLY, byday=recurrence.TU)
    pattern = Recurrence(dtstart=datetime(2015, 1, 1, 0, 0, 0),
                         dtend=datetime(2015, 1, 8, 0, 0, 0),
                         rrules=[rule])
    occurrences = [instance for instance in pattern.occurrences()]
    assert occurrences == [
        datetime(2015, 1, 6, 0, 0, 0),
    ]
Exemplo n.º 8
0
    def get_occurrences(self):
        occurrences_after_now = list(self.object.recurrences.occurrences())
        after_dt = datetime.combine(self.object.budgeted_date, datetime.min.time())
        recurrence = Recurrence(dtstart=after_dt,
                                dtend=occurrences_after_now[-1],
                                rrules=self.object.recurrences.rrules,
                                include_dtstart=False)

        return list(recurrence.occurrences())
Exemplo n.º 9
0
def test_exclusion_date_no_limits():
    pattern = Recurrence(rdates=[
        datetime(2014, 1, 1, 0, 0, 0),
        datetime(2014, 1, 2, 0, 0, 0),
    ],
                         exdates=[datetime(2014, 1, 2, 0, 0, 0)])

    occurrences = [instance for instance in pattern.occurrences()]

    assert occurrences == [
        datetime(2014, 1, 1, 0, 0, 0),
    ]

    assert 1 == pattern.count()
Exemplo n.º 10
0
    def test_recurrence_object_is_saved(self):
        """Test that naive datetimes will get converted to UTC and returned as UTC"""
        rule = Rule(recurrence.WEEKLY)

        limits = Recurrence(dtstart=datetime(2014, 1, 1, 0, 0, 0),
                            dtend=datetime(2014, 2, 3, 0, 0, 0),
                            rrules=[rule])

        event = EventWithNoNulls.objects.create(recurs=limits)

        event.refresh_from_db()

        instances = event.recurs.between(
            datetime(2010, 1, 1, 0, 0, 0, tzinfo=pytz.utc),
            datetime(2020, 12, 31, 0, 0, 0, tzinfo=pytz.utc))

        assert instances == [
            datetime(2014, 1, 1, 0, 0, tzinfo=pytz.utc),
            datetime(2014, 1, 8, 0, 0, tzinfo=pytz.utc),
            datetime(2014, 1, 15, 0, 0, tzinfo=pytz.utc),
            datetime(2014, 1, 22, 0, 0, tzinfo=pytz.utc),
            datetime(2014, 1, 29, 0, 0, tzinfo=pytz.utc),
            datetime(2014, 2, 3, 0, 0, tzinfo=pytz.utc)  # We always get dtend
        ]

        event = EventWithNoNulls.objects.get(pk=event.pk)

        expected_limits = Recurrence(dtstart=datetime(2014,
                                                      1,
                                                      1,
                                                      0,
                                                      0,
                                                      0,
                                                      tzinfo=pytz.utc),
                                     dtend=datetime(2014,
                                                    2,
                                                    3,
                                                    0,
                                                    0,
                                                    0,
                                                    tzinfo=pytz.utc),
                                     rrules=[rule])

        assert event.recurs == expected_limits

        assert event.recurs.between(
            datetime(2010, 1, 1, 0, 0, 0, tzinfo=pytz.utc),
            datetime(2020, 12, 31, 0, 0, 0, tzinfo=pytz.utc)) == instances
def test_recurrence_object_is_saved():
    rule = Rule(recurrence.WEEKLY)

    limits = Recurrence(dtstart=datetime(2014, 1, 1, 0, 0, 0),
                        dtend=datetime(2014, 2, 3, 0, 0, 0),
                        rrules=[rule])

    event = EventWithNoNulls.objects.create(recurs=limits)

    instances = event.recurs.between(datetime(2010, 1, 1, 0, 0, 0),
                                     datetime(2020, 12, 31, 0, 0, 0))

    assert instances == [
        datetime(2014, 1, 1, 0, 0),
        datetime(2014, 1, 8, 0, 0),
        datetime(2014, 1, 15, 0, 0),
        datetime(2014, 1, 22, 0, 0),
        datetime(2014, 1, 29, 0, 0),
    ]

    event = EventWithNoNulls.objects.get(pk=event.pk)

    assert event.recurs == limits

    assert event.recurs.between(datetime(2010, 1, 1, 0, 0, 0),
                                datetime(2020, 12, 31, 0, 0, 0)) == instances
Exemplo n.º 12
0
def test_include_dtstart_from_field():
    rule = Rule(
        recurrence.WEEKLY,
        byday=recurrence.MONDAY
    )

    limits = Recurrence(
        rrules=[rule]
    )

    value = recurrence.serialize(limits)

    model_field = recurrence.fields.RecurrenceField()  # Test with include_dtstart=True (default)
    rec_obj = model_field.to_python(value)
    assert rec_obj == limits
    # 2nd of August (dtstart) is expected but only for inc=True
    assert rec_obj.between(datetime(2015, 8, 2), datetime(2015, 8, 11), inc=True, dtstart=datetime(2015, 8, 2)) == [
        datetime(2015, 8, 2, 0, 0), datetime(2015, 8, 3, 0, 0), datetime(2015, 8, 10, 0, 0)]
    assert rec_obj.between(datetime(2015, 8, 2), datetime(2015, 8, 11), inc=False, dtstart=datetime(2015, 8, 2)) == [
        datetime(2015, 8, 3, 0, 0), datetime(2015, 8, 10, 0, 0)]

    model_field = recurrence.fields.RecurrenceField(include_dtstart=False)  # Test with include_dtstart=False
    rec_obj = model_field.to_python(value)
    assert rec_obj == limits
    # 2nd of August (dtstart) is not expected regardless of inc
    assert rec_obj.between(datetime(2015, 8, 2), datetime(2015, 8, 11), inc=True, dtstart=datetime(2015, 8, 2)) == [
        datetime(2015, 8, 3, 0, 0), datetime(2015, 8, 10, 0, 0)]
    assert rec_obj.between(datetime(2015, 8, 2), datetime(2015, 8, 11), inc=False, dtstart=datetime(2015, 8, 2)) == [
        datetime(2015, 8, 3, 0, 0), datetime(2015, 8, 10, 0, 0)]
Exemplo n.º 13
0
def test_recurs_errors_on_none_if_null_set_to_false():
    event = EventWithNoNulls.objects.create()

    # We should get an error
    pprint(event.__dict__)
    assert False
    assert event.recurs == Recurrence()
Exemplo n.º 14
0
def test_exclusion_date():
    rule = Rule(recurrence.DAILY)

    pattern = Recurrence(dtstart=datetime(2014, 1, 2, 0, 0, 0),
                         dtend=datetime(2014, 1, 4, 0, 0, 0),
                         rrules=[rule],
                         exdates=[datetime(2014, 1, 3, 0, 0, 0)])

    occurrences = [instance for instance in pattern.occurrences()]

    assert occurrences == [
        datetime(2014, 1, 2, 0, 0, 0),
        datetime(2014, 1, 4, 0, 0, 0),
    ]

    assert 2 == pattern.count()
Exemplo n.º 15
0
def test_invalid_wkst_recurrence_object_raises():
    with pytest.raises(recurrence.SerializationError):
        EventWithNoNulls.objects.create(
            recurs=Recurrence(
                rrules=[Rule(recurrence.DAILY, wkst=17)]
            )
        )
Exemplo n.º 16
0
def test_invalid_byday_recurrence_object_raises():
    with pytest.raises(ValidationError):
        EventWithNoNulls.objects.create(
            recurs=Recurrence(
                rrules=[Rule(recurrence.DAILY, byday='house')]
            )
        )
Exemplo n.º 17
0
def test_invalid_exclusion_interval_recurrence_object_raises():
    with pytest.raises(ValidationError):
        EventWithNoNulls.objects.create(
            recurs=Recurrence(
                exrules=[Rule(recurrence.DAILY, interval=0)]
            )
        )
Exemplo n.º 18
0
def test_invalid_bymonth_too_high_recurrence_object_raises():
    with pytest.raises(recurrence.SerializationError):
        EventWithNoNulls.objects.create(
            recurs=Recurrence(
                rrules=[Rule(recurrence.DAILY, bymonth=[1, 32])]
            )
        )
Exemplo n.º 19
0
    def test_strip_dtstart_and_dtend_if_required(self):
        """Test that naive datetimes will get converted to UTC and returned as UTC."""
        rule = Rule(recurrence.WEEKLY)

        limits = Recurrence(dtstart=datetime(2014, 1, 1, 0, 0, 0),
                            dtend=datetime(2014, 2, 3, 0, 0, 0),
                            rrules=[rule])

        value = recurrence.serialize(limits)

        field = RecurrenceField()
        cleaned_value = field.clean(value)
        assert cleaned_value.rrules == [rule]
        assert cleaned_value.dtstart == datetime(2014,
                                                 1,
                                                 1,
                                                 0,
                                                 0,
                                                 0,
                                                 tzinfo=pytz.utc)
        assert cleaned_value.dtend == datetime(2014,
                                               2,
                                               3,
                                               0,
                                               0,
                                               0,
                                               tzinfo=pytz.utc)

        field = RecurrenceField(accept_dtstart=False, accept_dtend=False)
        cleaned_value = field.clean(value)
        assert cleaned_value != limits
        assert cleaned_value.dtstart is None
        assert cleaned_value.dtend is None
Exemplo n.º 20
0
def test_invalid_exclusion_date_recurrence_object_raises():
    with pytest.raises(ValidationError):
        EventWithNoNulls.objects.create(
            recurs=Recurrence(
                exdates=["fish"]
            )
        )
Exemplo n.º 21
0
    def __init__(self, num_units,
                 function,
                 n_layers=2, n_gac=0,  
                 use_function_values=False, scale_output=1.0,
                 preprocess_input=True, p=10., loglr=True,
                 p_drop_grad=0.0 , fix_drop_grad_over_time=False,
                 p_drop_delta=0.0, fix_drop_delta_over_time=False,
                 p_drop_coord=0.0, fix_drop_coord_over_time=False,
                 gradient_steps=-1, grad_clipping=0,
                 params_input=None, input_var=None, n_steps=None, 
                 **kwargs):
        
        super(LSTM_Optimizer, self).__init__()

        self.num_units = num_units
        input_var = input_var or T.vector()
        n_steps = n_steps or T.iscalar()

        l_input = L.layers.InputLayer(shape=(None,), input_var=input_var)
        l_grad = GradLayer(l_input, function)
        l_func = IndexLayer(l_grad, 1)

        l_lstm = IndexLayer(l_grad, 0)
        #l_lstm = L.layers.dropout(l_input, p=p_drop_grad) # fix over time
        l_lstm = PreprocessLayer(l_lstm, preprocess_input=preprocess_input, p=p, use_function_values=use_function_values)

        recurrent_connections = { }

        for i in range(n_layers):
            l_lstm_cell = L.layers.InputLayer(shape=(None, num_units))
            l_lstm_hid = L.layers.InputLayer(shape=(None, num_units))
            l_lstm = LSTMStep(l_lstm, l_lstm_cell, l_lstm_hid, num_units=num_units, n_gac=n_gac, grad_clipping=grad_clipping)

            l_cell = IndexLayer(l_lstm, 0)
            l_hid  = IndexLayer(l_lstm, 1)

            l_lstm = l_hid

            recurrent_connections[l_lstm_cell] = l_cell
            recurrent_connections[l_lstm_hid]  = l_hid

        l_opt = OptStep(l_lstm, num_units, loglr=loglr)
        #l_opt = L.layers.dropout(l_opt, p=p_drop_delta) # fix over time

        l_opt = ThetaStep(l_input, l_opt, input_var, scale_output=scale_output)
        recurrent_connections[l_input] = l_opt

        l_rec = Recurrence(
            l_input,
            n_steps=n_steps,
            recurrent_connections=recurrent_connections,
            outputs=[l_opt, l_func],
            gradient_steps=gradient_steps,
        )

        self.l_opt = l_opt
        self.l_rec = l_rec

        self.input_var = input_var
        self.n_steps = n_steps
Exemplo n.º 22
0
    def test_dt_start_and_dtend_converts_to_utc(self):
        """Convert the values for dtstart and dtend to UTC."""
        tz = pytz.timezone('America/Adak')

        limits = Recurrence(
            dtstart=datetime(2014, 1, 1, 0, 0, 0, tzinfo=tz),
            dtend=datetime(2014, 2, 3, 0, 0, 0, tzinfo=tz),
        )

        value = recurrence.serialize(limits)

        field = RecurrenceField()
        cleaned_value = field.clean(value)
        assert cleaned_value.dtstart == datetime(2014,
                                                 1,
                                                 1,
                                                 0,
                                                 0,
                                                 0,
                                                 tzinfo=tz).astimezone(
                                                     pytz.utc)
        assert cleaned_value.dtend == datetime(2014, 2, 3, 0, 0, 0,
                                               tzinfo=tz).astimezone(pytz.utc)
        assert cleaned_value.dtstart.tzname() == 'UTC'
        assert cleaned_value.dtend.tzname() == 'UTC'
Exemplo n.º 23
0
def test_invalid_date_recurrence_object_raises():
    with pytest.raises(recurrence.SerializationError):
        EventWithNoNulls.objects.create(
            recurs=Recurrence(
                rdates=["fish"]
            )
        )
Exemplo n.º 24
0
def test_invalid_bymonth_toolow_recurrence_object_raises():
    with pytest.raises(ValidationError):
        EventWithNoNulls.objects.create(
            recurs=Recurrence(
                rrules=[Rule(recurrence.DAILY, bymonth=[0, ])]
            )
        )
Exemplo n.º 25
0
def test_invalid_count_recurrence_object_raises():
    with pytest.raises(ValidationError):
        EventWithNoNulls.objects.create(
            recurs=Recurrence(
                rrules=[Rule(recurrence.DAILY, count='fish')]
            )
        )
Exemplo n.º 26
0
def test_rule_serialization():
    rule = Rule(
        recurrence.WEEKLY
    )

    serialized = recurrence.serialize(rule)
    assert 'RRULE:FREQ=WEEKLY' == serialized
    assert recurrence.deserialize(serialized) == Recurrence(rrules=[rule])
Exemplo n.º 27
0
def test_occurrences_with_specific_include_dates():
    pattern = Recurrence(rdates=[datetime(2014, 1, 1, 0, 0, 0), datetime(2014, 1, 2, 0, 0, 0)])

    occurrences = [
        instance
        for instance in pattern.occurrences(dtstart=datetime(2014, 1, 1, 0, 0, 0), dtend=datetime(2014, 1, 4, 0, 0, 0))
    ]

    assert occurrences == [datetime(2014, 1, 1, 0, 0, 0), datetime(2014, 1, 2, 0, 0, 0), datetime(2014, 1, 4, 0, 0, 0)]

    assert 3 == pattern.count(dtstart=datetime(2014, 1, 1, 0, 0, 0), dtend=datetime(2014, 1, 4, 0, 0, 0))

    all_occurrences = [instance for instance in pattern.occurrences()]

    assert all_occurrences == [datetime(2014, 1, 1, 0, 0, 0), datetime(2014, 1, 2, 0, 0, 0)]

    assert 2 == pattern.count()
Exemplo n.º 28
0
 def _create_schedule(self):
     new_schedule = Schedule.objects.get(id=self.schedule.id)
     new_schedule.id = new_schedule.pk = None
     new_schedule.start_dt = pytz.utc.localize(
         datetime.datetime(2015, 1, 1, 18, 30, 0))
     new_schedule.recurrences = Recurrence()
     new_schedule.save()
     return new_schedule
Exemplo n.º 29
0
 def test_aware_until_gets_converted_to_utc(self):
     tz = pytz.timezone('America/Adak')
     until = datetime(2014, 1, 1, 0, 0, 0, tzinfo=tz)
     recurs = Recurrence(rrules=[Rule(recurrence.DAILY, until=until)], )
     value = recurrence.serialize(recurs)
     field = RecurrenceField()
     cleaned_value = field.clean(value)
     assert cleaned_value.rrules[0].until == until.astimezone(pytz.utc)
Exemplo n.º 30
0
def test_exclusion_rule():
    inclusion_rule = Rule(recurrence.DAILY)

    exclusion_rule = Rule(recurrence.WEEKLY, byday=recurrence.THURSDAY)

    pattern = Recurrence(dtstart=datetime(2014, 1, 2, 0, 0, 0),
                         dtend=datetime(2014, 1, 4, 0, 0, 0),
                         rrules=[inclusion_rule],
                         exrules=[exclusion_rule])

    occurrences = [instance for instance in pattern.occurrences()]

    assert occurrences == [
        datetime(2014, 1, 3, 0, 0, 0),
        datetime(2014, 1, 4, 0, 0, 0),
    ]

    assert 2 == pattern.count()
Exemplo n.º 31
0
def test_check_max_rrules():
    rule = Rule(recurrence.WEEKLY)

    limits = Recurrence(rrules=[rule])

    value = recurrence.serialize(limits)

    field = RecurrenceField(max_rrules=0)
    with pytest.raises(forms.ValidationError) as e:
        field.clean(value)
    assert e.value.messages[0] == "Max rules exceeded. The limit is 0"
def test_exclusion_date_no_limits():
    pattern = Recurrence(
        rdates=[
            datetime(2014, 1, 1, 0, 0, 0),
            datetime(2014, 1, 2, 0, 0, 0),
        ],
        exdates=[
            datetime(2014, 1, 2, 0, 0, 0)
        ]
    )

    occurrences = [
        instance for instance in
        pattern.occurrences()
    ]

    assert occurrences == [
        datetime(2014, 1, 1, 0, 0, 0),
    ]

    assert 1 == pattern.count()
def test_occurrences_with_specific_include_dates():
    pattern = Recurrence(rdates=[
        datetime(2014, 1, 1, 0, 0, 0),
        datetime(2014, 1, 2, 0, 0, 0),
    ])

    occurrences = [
        instance for instance in pattern.occurrences(
            dtstart=datetime(2014, 1, 1, 0, 0, 0),
            dtend=datetime(2014, 1, 4, 0, 0, 0),
        )
    ]

    assert occurrences == [
        datetime(2014, 1, 1, 0, 0, 0),
        datetime(2014, 1, 2, 0, 0, 0),
    ]

    assert 2 == pattern.count(
        dtstart=datetime(2014, 1, 1, 0, 0, 0),
        dtend=datetime(2014, 1, 4, 0, 0, 0),
    )

    all_occurrences = [instance for instance in pattern.occurrences()]

    assert all_occurrences == [
        datetime(2014, 1, 1, 0, 0, 0),
        datetime(2014, 1, 2, 0, 0, 0),
    ]

    assert 2 == pattern.count()
def test_complex_rule_serialization_with_weekday_instance():
    rule = Rule(
        recurrence.WEEKLY,
        interval=17,
        wkst=recurrence.to_weekday(1),
        count=7,
        byday=[recurrence.to_weekday('-1MO'),
               recurrence.to_weekday('TU')],
        bymonth=[1, 3])

    serialized = recurrence.serialize(rule)
    assert ('RRULE:FREQ=WEEKLY;INTERVAL=17;WKST=TU;'
            'COUNT=7;BYDAY=-1MO,TU;BYMONTH=1,3') == serialized
    assert recurrence.deserialize(serialized) == Recurrence(rrules=[rule])
Exemplo n.º 35
0
 def test_naive_until_gets_converted_to_utc(self):
     recurs = Recurrence(rrules=[
         Rule(recurrence.DAILY, until=datetime(2014, 1, 1, 0, 0, 0))
     ], )
     value = recurrence.serialize(recurs)
     field = RecurrenceField()
     cleaned_value = field.clean(value)
     assert cleaned_value.rrules[0].until == datetime(2014,
                                                      1,
                                                      1,
                                                      0,
                                                      0,
                                                      0,
                                                      tzinfo=pytz.utc)
def test_include_dtstart_from_object():
    rule = Rule(
        recurrence.WEEKLY,
        byday=recurrence.MONDAY
    )

    limits = Recurrence(  # include_dtstart=True (default)
        rrules=[rule]
    )

    assert limits.between(datetime(2015, 8, 2), datetime(2015, 8, 11), inc=True, dtstart=datetime(2015, 8, 2)) == [
        datetime(2015, 8, 2, 0, 0), datetime(2015, 8, 3, 0, 0), datetime(2015, 8, 10, 0, 0)]
    assert limits.between(datetime(2015, 8, 2), datetime(2015, 8, 11), inc=False, dtstart=datetime(2015, 8, 2)) == [
        datetime(2015, 8, 3, 0, 0), datetime(2015, 8, 10, 0, 0)]

    limits = Recurrence(  # include_dtstart=False (dtstart is expected to not be included)
        include_dtstart=False,
        rrules=[rule]
    )

    assert limits.between(datetime(2015, 8, 2), datetime(2015, 8, 11), inc=True, dtstart=datetime(2015, 8, 2)) == [
        datetime(2015, 8, 3, 0, 0), datetime(2015, 8, 10, 0, 0)]
    assert limits.between(datetime(2015, 8, 2), datetime(2015, 8, 11), inc=False, dtstart=datetime(2015, 8, 2)) == [
        datetime(2015, 8, 3, 0, 0), datetime(2015, 8, 10, 0, 0)]