Commits

Tino de Bruijn committed 7209fbf

Fixed bug where a TypeError would not be caught when too much data was received

Comments (0)

Files changed (2)

pyfirmata/pyfirmata.py

             return False
         try:
             handler(*data)
-        except ValueError, TypeError:
+        except (ValueError, TypeError):
             # TypeError occurs when we pass to many arguments.
             # ValueError may be thrown when the received data is not correct.
             return True
         sysex = (chr(0xF0), chr(0x7), chr(1), chr(2), chr(3), chr(0xF7))
         self.assert_serial(*sysex)
         
+    def test_too_much_data(self):
+        """ 
+        ``_process_command`` should return True when too much data is given
+        for a handler.
+        """
+        res = self.board._process_command(pyfirmata.ANALOG_MESSAGE, [1, 1, 1, 1, 1])
+        self.assertTrue(res)
         
 class TestBoardLayout(BoardBaseTest):