-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_message.py
More file actions
66 lines (50 loc) · 1.32 KB
/
Copy pathtest_message.py
File metadata and controls
66 lines (50 loc) · 1.32 KB
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
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""Unittest of Message"""
from nose2.tools import params
from typing import Any
import unittest
# custom imports
from generic_helper import Message
class TestMessage(unittest.TestCase):
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
@unittest.skip("Checked by test_set")
def test_clear(self) -> None:
pass
@params(
(None),
(False),
(True),
(0),
(1),
(3.14),
("string"),
(["string", True]),
({'key': ["string", True], 'key2': 42}),
)
def test_set(self, data: Any) -> None:
msg = Message()
msg.set(data)
result = msg.value()
self.assertEqual(result, data)
for x in range(3, 10):
msg.set(x)
result = msg.value()
self.assertNotEqual(result, data)
self.assertEqual(result, x)
msg2 = Message()
msg.set(msg2)
result = msg.value()
self.assertEqual(result, msg2)
@unittest.skip("Checked by test_set")
def test_is_set(self) -> None:
pass
@unittest.skip("Checked by test_set")
def test_value(self) -> None:
"""Test getting latest value of Message"""
pass
if __name__ == '__main__':
unittest.main()