-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
43 lines (36 loc) · 7.04 KB
/
test.py
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
import unittest
from daikin.daikin import Daikin
from daikin.daikin import utils
import time
class TestDaikin(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def setUp(self):
self.frame_on = [522, 391, 522, 424, 489, 424, 522, 391, 522, 424, 489, 26862, 3749, 1826, 489, 1337, 522, 424, 489, 424, 522, 424, 489, 1369, 489, 424, 522, 424, 424, 489, 456, 456, 456, 1402, 522, 424, 489, 1369, 489, 1337, 522, 424, 456, 1402, 489, 1369, 489, 1369, 489, 1337, 522, 1337, 522, 424, 424, 489, 456, 1402, 489, 456, 424, 489, 456, 489, 424, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 1402, 522, 424, 424, 1434, 424, 489, 456, 489, 424, 489, 456, 1402, 489, 1369, 489, 424, 456, 489, 424, 489, 456, 489, 424, 1402, 522, 424, 456, 456, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 456, 456, 1402, 489, 1369, 489, 1369, 489, 456, 424, 489, 424, 1434, 424, 1434, 424, 1434, 489, 37979, 3684, 1891, 424, 1402, 456, 489, 424, 489, 456, 489, 424, 1434, 424, 489, 456, 489, 424, 489, 456, 456, 456, 1402, 456, 489, 424, 1434, 424, 1434, 424, 489, 456, 1402, 489, 1369, 489, 1369, 424, 1402, 456, 1402, 489, 456, 424, 489, 456, 1402, 489, 456, 424, 489, 456, 456, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 1402, 489, 424, 456, 489, 424, 489, 456, 489, 424, 1434, 424, 489, 456, 456, 456, 489, 424, 1434, 456, 1402, 424, 1434, 424, 1402, 456, 1402, 522, 1337, 456, 489, 424, 489, 456, 1402, 424, 489, 456, 489, 424, 1434, 489, 424, 456, 489, 424, 489, 456, 456, 456, 1402, 456, 489, 424, 1434, 424, 1434, 489, 1337, 456, 489, 424, 38044, 3684, 1891, 424, 1434, 424, 489, 456, 489, 424, 489, 456, 1402, 489, 424, 456, 489, 424, 489, 456, 489, 424, 1434, 424, 489, 456, 1402, 489, 1369, 489, 424, 456, 1402, 456, 1402, 424, 1434, 424, 1434, 489, 1369, 424, 489, 456, 489, 424, 1402, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 456, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 456, 456, 1402, 456, 489, 424, 489, 456, 1402, 489, 1369, 489, 1369, 424, 489, 456, 489, 424, 489, 456, 1402, 456, 1402, 424, 1434, 424, 489, 456, 1402, 489, 456, 424, 489, 456, 456, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 456, 456, 489, 424, 489, 456, 1402, 456, 1402, 489, 456, 424, 1402, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 456, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 424, 1434, 424, 1434, 424, 489, 456, 489, 424, 489, 456, 456, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 1402, 424, 1434, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 1402, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 424, 489, 456, 489, 424, 1434, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 424, 1434, 489, 1369, 489, 424, 456, 1402, 424, 522, 424, 489, 424, 489, 456, 489, 424, 489, 456, 1402, 424, 522, 424, 489, 456, 456, 456, 489, 424, 489, 456, 489, 424, 489, 456, 489, 424, 489, 456, 1402, 424, 489, 456, 489, 424, 1434, 424, 1434, 424, 1402, 456, 1402, 489, 500000]
self.frame_off = [522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,26862 ,3749 ,1793 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,424 ,489 ,1337 ,522 ,1337 ,522 ,424 ,489 ,1369 ,489 ,1337 ,522 ,1337 ,522 ,1337 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,522 ,391 ,522 ,1337 ,522 ,424 ,489 ,1369 ,489 ,424 ,522 ,391 ,522 ,424 ,522 ,1337 ,489 ,1369 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,1337 ,522 ,1337 ,489 ,424 ,522 ,424 ,489 ,1369 ,489 ,1337 ,522 ,1337 ,522 ,37979 ,3749 ,1793 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1369 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,1337 ,522 ,424 ,489 ,1369 ,489 ,1337 ,522 ,424 ,522 ,1337 ,489 ,1369 ,489 ,1369 ,489 ,1337 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1369 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,1369 ,489 ,424 ,522 ,1337 ,522 ,424 ,489 ,1337 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1337 ,522 ,424 ,522 ,391 ,522 ,1337 ,522 ,1337 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,1337 ,522 ,1337 ,522 ,37946 ,3782 ,1793 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,391 ,522 ,1337 ,522 ,1337 ,522 ,424 ,489 ,1369 ,489 ,1337 ,522 ,1337 ,522 ,1337 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,1337 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,1337 ,522 ,1337 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1337 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1337 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1369 ,489 ,1337 ,522 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,1337 ,489 ,1369 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1369 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,1369 ,489 ,1369 ,489 ,424 ,522 ,1337 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,391 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,424 ,522 ,424 ,489 ,1337 ,522 ,1337 ,522 ,424 ,489 ,424 ,522 ,1337 ,522 ,1337 ,522 ,1337 ,522 ,391 ,522 ,108656]
def tearDown(self):
pass
# @unittest.skip
def test_decode_on(self):
client = Daikin()
message = client.get_message_from_durations(self.frame_on)
print(message)
block2 = message.block2
message.recreate_blocks()
print(message)
self.assertEqual(message.block2, block2)
durations = client.message_to_durations(message)
self.assertEqual(len(durations), len(self.frame_on))
@unittest.skip
def test_decode_off(self):
client = Daikin()
message = client.get_message_from_durations(self.frame_off)
block2 = message.block2
message.recreate_blocks()
self.assertEqual(message.block2, block2)
durations = client.message_to_durations(message)
self.assertEqual(len(durations), len(self.frame_off))