File: test_scheduler.py

package info (click to toggle)
python-rx 4.0.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,056 kB
  • sloc: python: 39,070; javascript: 77; makefile: 24
file content (30 lines) | stat: -rw-r--r-- 961 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest

from reactivex.internal.constants import DELTA_ZERO, UTC_ZERO
from reactivex.scheduler.scheduler import Scheduler


class TestScheduler(unittest.TestCase):
    def test_base_to_seconds(self):
        val = Scheduler.to_seconds(0.0)
        assert val == 0.0
        val = Scheduler.to_seconds(DELTA_ZERO)
        assert val == 0.0
        val = Scheduler.to_seconds(UTC_ZERO)
        assert val == 0.0

    def test_base_to_datetime(self):
        val = Scheduler.to_datetime(0.0)
        assert val == UTC_ZERO
        val = Scheduler.to_datetime(DELTA_ZERO)
        assert val == UTC_ZERO
        val = Scheduler.to_datetime(UTC_ZERO)
        assert val == UTC_ZERO

    def test_base_to_timedelta(self):
        val = Scheduler.to_timedelta(0.0)
        assert val == DELTA_ZERO
        val = Scheduler.to_timedelta(DELTA_ZERO)
        assert val == DELTA_ZERO
        val = Scheduler.to_timedelta(UTC_ZERO)
        assert val == DELTA_ZERO