1. Ben Bass
  2. pylibftdi

Source

pylibftdi / tests / test_driver.py

Diff from to

File tests/test_driver.py

  • Ignore whitespace
 """
 
 from tests.test_common import (LoopDevice, Device, CallCheckMixin, unittest)
+from pylibftdi import FtdiError
 
 # and now some test cases...
 
             self.assertCalls(dev.flush_output, 'ftdi_usb_purge_tx_buffer')
             self.assertCalls(dev.flush, 'ftdi_usb_purge_buffers')
 
+    def testClose(self):
+        d = Device()
+        d.close()
+        self.assertRaises(FtdiError, d.write, 'hello')
+        d = Device()
+        d.close()
+        self.assertRaises(FtdiError, d.read, 1)
+
 
 class LoopbackTest(unittest.TestCase):
     """