Пример #1
0
    def test_seconds(self, input_datetime, unit_quantity, expected_start):
        tf = TimeframeMixin(unit=Unit.SECOND, unit_quantity=unit_quantity)

        assert tf.get_frame_start(
            arrow.get(input_datetime)) == arrow.get(expected_start)
Пример #2
0
 def test_nominal(self, unit, unit_quantity):
     with pytest.raises(TimeFrameException):
         TimeframeMixin(unit=unit, unit_quantity=unit_quantity)
Пример #3
0
    def test_tick(self):
        tf = TimeframeMixin(unit=Unit.TICK, unit_quantity=3)

        now = arrow.utcnow()
        assert tf.get_frame_start(now) == now
Пример #4
0
    def test_days(self, input_datetime, unit_quantity, expected_end):
        tf = TimeframeMixin(unit=Unit.DAY, unit_quantity=unit_quantity)

        timeframe_end = tf.get_frame_end(arrow.get(input_datetime))

        assert timeframe_end == arrow.get(expected_end)
Пример #5
0
    def test_unit_quantity(self):
        tf = TimeframeMixin(unit=Unit.SECOND, unit_quantity=4)

        assert tf.unit_quantity == 4
Пример #6
0
    def test_tick(self):
        tf = TimeframeMixin(unit=Unit.TICK, unit_quantity=1)
        input_dt = arrow.utcnow()
        timeframe_end = tf.get_frame_end(input_dt)

        assert timeframe_end == input_dt
Пример #7
0
    def test_unit(self, unit):
        tf = TimeframeMixin(unit=unit, unit_quantity=1)

        assert tf.unit == unit
Пример #8
0
    def test_month(self, input_datetime, unit_quantity, expected_start):
        tf = TimeframeMixin(unit=Unit.MONTH, unit_quantity=unit_quantity)

        assert tf.get_frame_start(
            arrow.get(input_datetime)) == arrow.get(expected_start)