aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_slackts.py
blob: ab60d03d0d571a6630a0080c2f515e5af58e7074 (plain) (blame)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from slack.slack_message import SlackTs

str_base = "1234567890.012345"
str_base_not_padded = "1234567890.12345"
str_different_minor = "1234567890.012346"
str_different_major = "1234567891.012345"

ts_base = SlackTs(str_base)
ts_base_not_padded = SlackTs(str_base_not_padded)
ts_different_minor = SlackTs(str_different_minor)
ts_different_major = SlackTs(str_different_major)


def test_slackts_eq():
    assert ts_base == ts_base
    assert ts_base == ts_base_not_padded
    assert ts_base == str_base
    assert not ts_base == ts_different_minor
    assert not ts_base == ts_different_major
    assert not ts_base == str_different_minor
    assert not ts_base == str_different_major


def test_slackts_ne():
    assert ts_base != ts_different_minor
    assert ts_base != ts_different_major
    assert ts_base != str_different_minor
    assert ts_base != str_different_major
    assert not ts_base != ts_base
    assert not ts_base != ts_base_not_padded
    assert not ts_base != str_base


def test_slackts_gt():
    assert ts_different_minor > ts_base
    assert ts_different_major > ts_base
    assert str_different_minor > ts_base
    assert str_different_major > ts_base
    assert not ts_base > ts_base
    assert not ts_base > ts_base_not_padded
    assert not ts_base > ts_different_minor
    assert not ts_base > ts_different_major
    assert not ts_base > str_base
    assert not ts_base > str_different_minor
    assert not ts_base > str_different_major


def test_slackts_ge():
    assert ts_base >= ts_base
    assert ts_base >= ts_base_not_padded
    assert ts_different_minor >= ts_base
    assert ts_different_major >= ts_base
    assert ts_base >= str_base
    assert str_different_minor >= ts_base
    assert str_different_major >= ts_base
    assert not ts_base >= ts_different_minor
    assert not ts_base >= ts_different_major
    assert not ts_base >= str_different_minor
    assert not ts_base >= str_different_major


def test_slackts_lt():
    assert ts_base < ts_different_minor
    assert ts_base < ts_different_major
    assert ts_base < str_different_minor
    assert ts_base < str_different_major
    assert not ts_base < ts_base
    assert not ts_base < ts_base_not_padded
    assert not ts_different_minor < ts_base
    assert not ts_different_major < ts_base
    assert not ts_base < str_base
    assert not str_different_minor < ts_base
    assert not str_different_major < ts_base


def test_slackts_le():
    assert ts_base <= ts_base
    assert ts_base <= ts_base_not_padded
    assert ts_base <= ts_different_minor
    assert ts_base <= ts_different_major
    assert ts_base <= str_base
    assert ts_base <= str_different_minor
    assert ts_base <= str_different_major
    assert not ts_different_minor <= ts_base
    assert not ts_different_major <= ts_base
    assert not str_different_minor <= ts_base
    assert not str_different_major <= ts_base