diff options
Diffstat (limited to 'utilities/test_blinkenrocket.py')
-rw-r--r-- | utilities/test_blinkenrocket.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/utilities/test_blinkenrocket.py b/utilities/test_blinkenrocket.py index 27d213d..11d8d91 100644 --- a/utilities/test_blinkenrocket.py +++ b/utilities/test_blinkenrocket.py @@ -96,5 +96,21 @@ class TestText(unittest.TestCase): text = textFrame([],speed=7,delay=8,direction=1) self.assertEquals(text.getHeader(),[chr(7 << 4 | 8),chr(1 << 4 | 0)]) +class TestBlinkenrocket(unittest.TestCase): + + def test_addFrameFail(self): + br = blinkenrocket() + with self.assertRaises(Exception): + br.addFrame([]) + + def test_addFrameText(self): + text = textFrame("MUZY",speed=7,delay=8,direction=1) + self.assertEquals(text.getHeader(),[chr(7 << 4 | 8),chr(1 << 4 | 0)]) + self.assertEquals(text.getRepresentation(),[chr(7 << 4 | 8),chr(1 << 4 | 0),'M','U','Z','Y']) + br = blinkenrocket() + br.addFrame(text) + expect = [chr(0x99),chr(0x99),chr(0xA9),chr(0xA9),chr(7 << 4 | 8),chr(1 << 4 | 0),'M','U','Z','Y'] + self.assertEquals(br.getMessage(),expect) + if __name__ == '__main__': unittest.main()
\ No newline at end of file |