Mercurial > templog
comparison py/test.py @ 572:453c4c0eab3a
syntax fixes, doesn't make sense yet for asyncio
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 17 Nov 2015 22:26:00 +0800 |
parents | 5201f441bf4a |
children |
comparison
equal
deleted
inserted
replaced
571:ccfaa4351fd8 | 572:453c4c0eab3a |
---|---|
1 #!/usr/bin/env python2.7 | |
2 import io | 1 import io |
3 | 2 |
4 import unittest | 3 import unittest |
5 import sensor_ds18b20 | 4 import sensor_ds18b20 |
6 import params | 5 import params |
7 | 6 |
8 class TestSensors(unittest.TestCase): | 7 class TestSensors(unittest.TestCase): |
9 def setUp(self): | 8 def setUp(self): |
10 self.sensors = sensor_ds18b20.DS18B20s(None) | 9 self.sensors = sensor_ds18b20.SensorDS18B20(None) |
11 | 10 |
12 def test_sensors_regex(self): | 11 def test_sensors_regex(self): |
13 f1 = """6e 01 4b 46 7f ff 02 10 71 : crc=71 YES | 12 f1 = """6e 01 4b 46 7f ff 02 10 71 : crc=71 YES |
14 6e 01 4b 46 7f ff 02 10 71 t=22875 | 13 6e 01 4b 46 7f ff 02 10 71 t=22875 |
15 """ | 14 """ |
64 | 63 |
65 def test_params_save(self): | 64 def test_params_save(self): |
66 jsbuf = io.StringIO() | 65 jsbuf = io.StringIO() |
67 | 66 |
68 self.params.overshoot_delay = 123 | 67 self.params.overshoot_delay = 123 |
69 self.params.save(f=jsbuf) | 68 s = self.params.save_string() |
70 | |
71 s = jsbuf.getvalue() | |
72 self.assertTrue('"overshoot_delay": 123' in s, msg=s) | 69 self.assertTrue('"overshoot_delay": 123' in s, msg=s) |
73 | 70 |
74 unittest.main() | 71 unittest.main() |