Skip to content

Commit

Permalink
Test signal device
Browse files Browse the repository at this point in the history
  • Loading branch information
tfarago committed Aug 7, 2014
1 parent 36833b5 commit ad7594a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion concert/tests/unit/devices/test_io.py
@@ -1,6 +1,7 @@
from concert.tests import TestCase
from concert.base import TransitionNotAllowed
from concert.devices.io.base import IODeviceError
from concert.devices.io.dummy import IO
from concert.devices.io.dummy import IO, Signal


class TestIO(TestCase):
Expand All @@ -22,3 +23,24 @@ def test_non_existent_read(self):

def test_non_existent_write(self):
self.assertRaises(IODeviceError, self.io.write_port, 1, 0)


class TestSignal(TestCase):

def setUp(self):
self.signal = Signal()

def test_on(self):
self.signal.on()
self.assertEqual(self.signal.state, 'on')

with self.assertRaises(TransitionNotAllowed):
self.signal.on()

def test_off(self):
self.signal.on()
self.signal.off()
self.assertEqual(self.signal.state, 'off')

with self.assertRaises(TransitionNotAllowed):
self.signal.off()

0 comments on commit ad7594a

Please sign in to comment.